Closed
Description
TypeScript Version: 3.3.0-dev.20190124
Search Terms:
- tsc jsdoc crash
- TypeError: Cannot read property 'flags' of undefined
Code
This snippet crashes the compiler:
function Foo() { }
/** @type {{}} **/
Foo.Bar = null;
Stack trace:
> ./node_modules/typescript/bin/tsc crash.ts /home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:71419 throw e; ^ TypeError: Cannot read property 'flags' of undefined at getMembersOfSymbol (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:30458:27) at getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:33423:21) at getTypeFromTypeNode (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:33702:28) at getJSDocTypeFromAssignmentDeclaration (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:29309:43) at getWidenedTypeFromAssignmentDeclaration (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:29260:33) at getTypeOfVariableOrParameterOrPropertyWorker (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:29557:21) at getTypeOfVariableOrParameterOrProperty (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:29502:48) at getTypeOfSymbol (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:29777:24) at checkPropertyAccessExpressionOrQualifiedName (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:40629:53) at checkPropertyAccessExpression (/home/attila/dev/projects/temp/2019-01-24/tsc-jsdoc-crash/node_modules/typescript/lib/tsc.js:40581:20)
A self contained demonstration can be found here: https://github.com/attila-kun/tsc-jsdoc-crash
Or on the Playground (observe exception in the console): https://www.typescriptlang.org/play/#src=function%20Foo()%20%7B%20%7D%0D%0A%2F**%20%40type%20%7B%7B%7D%7D%20**%2F%0D%0AFoo.Bar%20%3D%20null%3B
Expected behavior:
No crash.
Actual behavior:
tsc crashes.