-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
The following code crashes the compiler:
// File tmp.ts
class Injectable {
constructor(...args: any[]) {
console.log('args:', args);
}
static inject(clazz: any, injectables: string[]): void {
console.log('clazz:', clazz, 'injectables:', injectables);
}
}
function Inject(args: string[]): Function {
return (target: any) => {
Injectable.inject(target, args);
};
}
@Inject(['a', 'b'])
class A extends Injectable {
constructor(...injectables) {
super(...injectables);
}
}
// Without the decorator
// Injectable.inject(A, ['a', 'b']);
export default A;
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue