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
Code similar to the above worked by chance in 4.1 beta because template literal types would collapse to just string when one or more placeholders were ${string}. The code now fails. The core issue is an infinite buildup of nested indexed access types (i.e. T[string][string][string][string]...) that results from constraint resolution. We've seen errors like these before that similarly trip the constraint depth limiter. What need a stack that keeps track of types for which we're resolving constraints and a limit after which we stop the exploration (and resolve to no constraint) using isDeeplyNestedType logic similar to type relationships. I will put up a PR to that effect.
TypeScript Version: 4.1.0-dev
Code
Expected behavior:
No errors.
Actual behavior:
"Type instantiation is excessively deep and possibly infinite" error on declaration of
getProp
.Playground Link:
https://www.typescriptlang.org/play?ts=4.1.0-dev.20201006#code/C4TwDgpgBACghsAFgaQiAzgHgCoD4oC8AUFKVNlBAB7AQB2AJulAE4RwMD2dANiFHDogA2gF0oAfigBRGizgBjYJgDWaTgDNyAGigADACQBvOgFcAtgCMILAL578AHygBlU5dQYcu2cHlLVdS1sXUMTC2s7B3wALhIyCmpaRmZOSwArCCVJGTlFZTUQTR0odD8ASzoAcydXd08sENy-fMCi4N0ylkqa2PjSOggANxsAbiIiUEg6jzRG3WRKGnomUorq-AIoRaSV5kLiiikw5FsAOmN4JAacYWRRXHsoGKhBkZZxyfBoGBZOMGw328sAQiCWyVWXR6m36IKQ4L2UAOwRy2GEV0Q4jiZDhYN2KX0xkqGhs23ORLoJJYUAASk8pDtlgTkeQcr9-oDILd7roabEoKY6Co6JwAO50Z6wwXCsV0T4MLI8OBsKAaQVKcrcKBVCDAdlgYEwBEEjE3PC4AAUaXSLyaYFBLxgAEpHX8AUCmjBcJ8FNwylBrYQoEZYXQ4OYIC8AOQAKU4iDoUe0sLgOpeABYAEzJnEKZXoF7CWE4oxQcxwNTRgBinBYDCTAjTUAAjAAGKC2HM4sil8uVqBR7DySyCYAN1ORqAAZgArB3YaIiLYBMxfXQyp8eLqyxXoFsdXq3VaMroo3mWOgzs2zn2IFGnaNSAB6J8DodwEd0MdEIA
The text was updated successfully, but these errors were encountered: