Typescript: Uninitialized identifer causes compiler crash

Created on 14 Dec 2019  路  4Comments  路  Source: microsoft/TypeScript

TypeScript Version: 3.8.0-dev

Code

// Compile with --strict
let a: {};
a;

Expected behavior:

No crash.

Actual behavior:

Crash!

Related Issues:

Crash is caused by code added in #33171. Beyond this crash, I see several issues with that code. For example, it assumes that if the return type is a union type, then the type annotation AST node is a UnionTypeNode, which by no means is a given. For example, the return type node could be a reference to a type alias.

Bug Crash High Priority

All 4 comments

@orta @RyanCavanaugh For now, I'd prefer we revert #33171. Then we can work on getting it right.

@ahejlsberg Can you fix #35567? Otherwise I (and other developers) can't introduce asserts predicate because it breaks correct tests.

@falsandtru Please restrict yourself to comments that are relevant to this issue. Thanks!

@ahejlsberg You are the person responsible for asserts predicate you made. Developers can't understand how to introduce it to existing tests without your explanation. At least you should make your design clear whether this incompatibility is intended or not.

Was this page helpful?
0 / 5 - 0 ratings