fix(compiler): automatically set emitDecoratorMetadata when "annotationsAs": "static fields” (#19927)

This is a workaround for https://github.com/angular/tsickle/issues/635.

Fixes #19916
PR Close #19927
This commit is contained in:
Tobias Bosch
2017-10-25 08:13:56 -07:00
committed by Matias Niemelä
parent 56b18ff063
commit d56724659f
2 changed files with 56 additions and 10 deletions

View File

@ -45,6 +45,12 @@ function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|un
if (!transformDecorators && !transformTypesToClosure) {
return undefined;
}
if (transformDecorators) {
// This is needed as a workaround for https://github.com/angular/tsickle/issues/635
// Otherwise tsickle might emit references to non imported values
// as TypeScript elided the import.
options.emitDecoratorMetadata = true;
}
const tsickleHost: tsickle.TsickleHost = {
shouldSkipTsickleProcessing: (fileName) =>
/\.d\.ts$/.test(fileName) || GENERATED_FILES.test(fileName),