fix(ivy): ensure @nocollapse is added to static fields (#28050)

ngtsc has a hack to add @nocollapse jsdoc annotations to generated static
fields. This hack is currently broken (likely due to a TypeScript change
in the way writeFile() works).

This commit fixes the hack and introduces an ngtsc_spec test to ensure it
does not regress again.

PR Close #28050
This commit is contained in:
Alex Rickabaugh
2019-01-10 10:40:24 -08:00
committed by Andrew Kushnir
parent df292c2ce0
commit 61bc61fc59
2 changed files with 22 additions and 1 deletions

View File

@ -227,7 +227,7 @@ export class NgtscProgram implements api.Program {
if (fileName.endsWith('.d.ts')) {
data = sourceFiles.reduce(
(data, sf) => this.compilation !.transformedDtsFor(sf.fileName, data), data);
} else if (this.closureCompilerEnabled && fileName.endsWith('.ts')) {
} else if (this.closureCompilerEnabled && fileName.endsWith('.js')) {
data = nocollapseHack(data);
}
this.host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);