You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 22, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on May 22, 2025. It is now read-only.
Imports for types of ctor arguments are elided although they are lowered into a static property #635
import {AClass} from './aclass';
class MyService {
constructor(aclass: AClass) {}
}
Tsickle options: transformDecorators: true
Output:
main.js
// no import for AClass here!
...
MyService.ctorParameters = function () { return [
// although AClass is now in a value position
{ type: AClass, },
]; };
Root cause
TypeScript right now has now way of allowing a transformer to tell it to not elide a symbol that is only used in a type position (see microsoft/TypeScript#17516).
Workaround
Set emitDecoratorMetadata: true. This way, TypeScript won't elide the import as its own transformer would have moved it into a value position.
Note that this workaround is already applied in G3 and everywhere the current version of tsickle is used. This issue mostly serves the purpose of documenting this problem.
Activity
tbosch commentedon Oct 25, 2017
Note that this workaround is already applied in G3 and everywhere the current version of tsickle is used. This issue mostly serves the purpose of documenting this problem.
fix(compiler): automatically set `emitDecoratorMetadata` when `"annot…
fix(compiler): automatically set `emitDecoratorMetadata` when `"annot…