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 }}
Repository navigation
[emitDecoratorMetadata] TypeError: Cannot read property 'kind' of undefined #9135
// File tmp.tsclassInjectable{constructor(...args: any[]){console.log('args:',args);}staticinject(clazz: any,injectables: string[]): void{console.log('clazz:',clazz,'injectables:',injectables);}}functionInject(args: string[]): Function{return(target: any)=>{Injectable.inject(target,args);};}
@Inject(['a','b'])classAextendsInjectable{constructor(...injectables){super(...injectables);}}// Without the decorator// Injectable.inject(A, ['a', 'b']);exportdefaultA;
Results:
jmlopez in~/testing$ tsc -v
Version 1.8.10
jmlopez in~/testing$ tsc tmp.ts --experimentalDecorators --emitDecoratorMetadata
/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:33078
throw e;
^
TypeError: Cannot read property 'kind' of undefined
at emitSerializedParameterTypesOfNode (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30799:54)
at emitSerializedTypeMetadata (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30844:25)
at emitDecoratorsOfConstructor (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30537:17)
at emitDecoratorsOfClass (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30514:17)
at emitClassLikeDeclarationBelowES6 (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30474:17)
at emitClassLikeDeclaration (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30323:21)
at emitClassDeclaration (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:30319:24)
at emitJavaScriptWorker (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:32383:32)
at emitNodeWithoutSourceMap (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:32189:21)
at emitNodeWithSourceMap (/Users/jmlopez/testing/node_modules/typescript/lib/tsc.js:32183:21)
It works fine without the --emitDecoratorMetadata. I have also tested in Version 1.9.0-dev.20160217 and I obtain the same error.
Again, this happens only when using the --emitDecoratorMetadata flag. Another way to fix this is to add the type to args, that is, if we declare the class like this:
Activity
mhegazy commentedon Jun 13, 2016
Andy (Andrewkraft) (@Andy-MS) can you take a look.
jmlopez-rod commentedon Jun 13, 2016
Here is a more compact example that makes the compiler crash
Again, this happens only when using the
--emitDecoratorMetadataflag. Another way to fix this is to add the type toargs, that is, if we declare the class like this: