You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compilation crashes with "RangeError: maximum call stack size exceeded"
π Expected behavior
No crash with the type working correctly or explicit error on the recursive type like "Type instantiation is excessively deep and possibly infinite. ts(2589)"
The original type that caused the crash has mostly the same motivation as the blog post above. The provided snippet was simplified to a minimal reproducible example.
The text was updated successfully, but these errors were encountered:
Regression from this range of commits, likely from #55140 . It doesn't revert cleanly right now but I reverted locally the change introduced to shouldDeferIndexType and it stops crashing like this. I'll investigate this further soon.
π Search Terms
"Mapped type", "Recursive mapped type", "Recursive type", "RangeError: maximum call stack size exceeded"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.4.5#code/KYDwDg9gTgLgBDAnmYcBiAbAhjGwB2AKssADwDKEArlAMaqh74AmAznBAEYBWwtMAGjiEsUAObAYAPjgBeOAG8AUHDgBtANLBEcAJb44Aa20QAZnEo16cLOy07GBNnFYwo+sStVwA-Bep0wJraALpwjizsXLz8Xt6+cAAGACQK9gC+AHSpxohm6Ni4BMQoFAH0wYghQiLikjIAZC5uHumJcd4AXHD2Hd34wABuwFAhALQ+3bUSMADcSunzSkgo6LrAGMzkG3zw8sqqMFicGMDdru74YvOqpuub5y1X8+lKyyRwAILMzFDArOx9l5IK4AMIQZhnZqXa5eSGsWjuMAwXQQfCPGE3Gw-P4AjEeF5vFaoACqrBGckUXl0zH6VAAtpwRlj8Fh6VCLgSvFgcf9WN1vr8+YT3qtMDgmMBmGSKfJxUUiCRSDKoEI0Pctjt+FJ5gB6XXxQ0APR8QA
π» Code
π Actual behavior
Compilation crashes with "RangeError: maximum call stack size exceeded"
π Expected behavior
No crash with the type working correctly or explicit error on the recursive type like "Type instantiation is excessively deep and possibly infinite. ts(2589)"
Additional information about the issue
Same playground in version 5.3.3 where the type resolves with no crash
https://www.typescriptlang.org/play/?ts=5.3.3#code/KYDwDg9gTgLgBDAnmYcBiAbAhjGwB2AKssADwDKEArlAMaqh74AmAznBAEYBWwtMAGjiEsUAObAYAPjgBeOAG8AUHDgBtANLBEcAJb44Aa20QAZnEo16cLOy07GBNnFYwo+sStVwA-Bep0wJraALpwjizsXLz8Xt6+cAAGACQK9gC+AHSpxohm6Ni4BMQoFAH0wYghQiLikjIAZC5uHumJcd4AXHD2Hd34wABuwFAhALQ+3bUSMADcSunzSkgo6LrAGMzkG3zw8sqqMFicGMDdru74YvOqpuub5y1X8+lKyyRwAILMzFDArOx9l5IK4AMIQZhnZqXa5eSGsWjuMAwXQQfCPGE3Gw-P4AjEeF5vFaoACqrBGckUXl0zH6VAAtpwRlj8Fh6VCLgSvFgcf9WN1vr8+YT3qtMDgmMBmGSKfJxUUiCRSDKoEI0Pctjt+FJ5gB6XXxQ0APR8QA
We ran into this crash when upgrading the ts version in our project.
There's a workaround based on the approach described in https://blog.swmansion.com/deep-flatten-typescript-type-c0d123028d82 which doesn't cause a crash on these versions.
The original type that caused the crash has mostly the same motivation as the blog post above. The provided snippet was simplified to a minimal reproducible example.
The text was updated successfully, but these errors were encountered: