mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(compiler-cli): Emit type annotations for synthesized decorator fields (#43021)
Previously, the decorator transformer was annotating the synthesized properties with TS type annotations. However, because it ran after the JSDoc transformer, the TS types were just dropped from the emitted JS. Attempting to move the decorator transformer before the JSDoc transformer causes tsickle crashes because synthetic AST fragments are not attached to a SourceFile node. PR Close #43021
This commit is contained in:
committed by
Alex Rickabaugh
parent
49766d2d0a
commit
4341a5f4cb
@@ -715,7 +715,7 @@ describe('ngc transformer command-line', () => {
|
||||
const mymoduleSource = fs.readFileSync(mymodulejs, 'utf8');
|
||||
expect(mymoduleSource).toContain('@fileoverview added by tsickle');
|
||||
expect(mymoduleSource).toContain('@param {?} p');
|
||||
expect(mymoduleSource).toMatch(/\/\*\* @nocollapse \*\/\s+MyComp\.ctorParameters = /);
|
||||
expect(mymoduleSource).toContain('@nocollapse');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -424,11 +424,18 @@ describe('downlevel decorator transform', () => {
|
||||
|
||||
expect(diagnostics.length).toBe(0);
|
||||
expect(output).toContain(dedent`
|
||||
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
||||
MyDir.decorators = [
|
||||
{ type: core_1.Directive }
|
||||
];
|
||||
/** @nocollapse */
|
||||
MyDir.ctorParameters = () => [
|
||||
/**
|
||||
* @type {function(): !Array<(null|{
|
||||
* type: ?,
|
||||
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
||||
* })>}
|
||||
* @nocollapse
|
||||
*/
|
||||
MyDir.ctorParameters = () => [
|
||||
{ type: ClassInject }
|
||||
];
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user