Skip to content

Compiler hangs on union of enums with a large number of elements #12535

Description

TypeScript Version: 2.1 RC / (Version installed with VS 2017)

Code

namespaceenums{exportconstenumA{a1,a2,a3,// ... elements omitted for the sake of claritya75,a76,a77,}exportconstenumB{b1,b2,// ... elements omitted for the sake of clarityb86,b87,}exportconstenumC{c1,c2,// ... elements omitted for the sake of clarityc210,c211,}exporttypeGenre=A|B|C;}typeFoo={genreId: enums.Genre;};typeBar={genreId: enums.Genre;};typeFooBar=Foo&Bar;functionfoo(so: any){constval=soasFooBar;constisGenre=val.genreId;returnisGenre;}

Expected behavior:

Compilation in a few hundred milliseconds

Actual behavior:

Compilation took 1 minute 5 seconds for the code sample above (i.e. where the omitted enum elements are filled out exactly.) In the actual code, the build hangs indefinitely.

This bit of code was working fine with TS 2.0.

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions