Repository navigation
Takes a while with high memory to calculate highly recursive types with intersections #20558
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: PerformanceReports of unusually slow behaviorReports of unusually slow behavior
Milestone
Description
Activity
this is what i am seeing on latest in master:
RangeError: Maximum call stack size exceeded at getAnonymousTypeInstantiation (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:1:1) at instantiateType (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26419:32) at C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26261:42 at Object.map (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:477:29) at getAnonymousTypeInstantiation (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26344:40) at instantiateType (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26419:32) at C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26261:42 at Object.map (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:477:29) at getAnonymousTypeInstantiation (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26344:40) at instantiateType (C:\Users\mhegazy\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:26419:32)dead-claudia commented
on Feb 2, 2018 AuthorMore actionsMohamed Hegazy (@mhegazy) That's odd. I ran it on Mac, which from a quick Google search, has a higher default stack space limit, though - 8MB instead of 1MB. (In the release when I tested it, it did manage to eventually succeed.)
Note that the above example should validate as successful.
This old issue was fixed by the surprisingly new #52392; likely this deserves a test, if anything; its compile perf is not that bad post-fix (.7s on my machine).
Reacted by Claudia Meadows- addedDomain: PerformanceReports of unusually slow behaviorReports of unusually slow behavior
on Oct 16, 2025 - locked as resolved and limited conversation to collaborators
on Jun 5, 2026
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: PerformanceReports of unusually slow behaviorReports of unusually slow behavior
TypeScript Version: 2.6.2
Code
Apologies for the length - I can't really make the repro any smaller than this without it taking a fraction of the time and about half the memory. Also, note: this does not require a config.
Expected behavior: It to take maybe a few seconds. Remove any one function or property out of that, and that's the compilation time I would normally expect.
Actual behavior: It takes ~15-20 seconds to check, and requires ~180-200 MB of memory in the process.