-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Description
TypeScript Version: 3.8.2
Search Terms: 'flags' of undefined
Code
export class Class {
#field: any
}
const task: Class = {} as unknownExpected behavior:
To give the compile error: Type 'unknown' is not assignable to type 'Class'.
Actual behavior:
Crashes with :
/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:80993
throw e;
^
TypeError: Cannot read property 'flags' of undefined
at reportUnmatchedProperty (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:40618:38)
at propertiesRelatedTo (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:40663:25)
at structuredTypeRelatedTo (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:40349:34)
at recursiveTypeRelatedTo (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:40096:53)
at isRelatedTo (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:39777:38)
at checkTypeRelatedTo (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:39487:26)
at checkTypeRelatedToAndOptionallyElaborate (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:38806:24)
at checkTypeAssignableToAndOptionallyElaborate (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:38800:20)
at checkVariableLikeDeclaration (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:52072:25)
at checkVariableDeclaration (/Users/valentin/Zenika/Projects/cuillere/node_modules/typescript/lib/tsc.js:52136:20)Playground Link: I didn't found a way to reproduce this behaviour in the playground.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript