Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change: Depth limit now hit for some types in 4.3 #43877

Closed
dragomirtitian opened this issue Apr 29, 2021 · 4 comments Β· Fixed by #54030
Closed

Breaking change: Depth limit now hit for some types in 4.3 #43877

dragomirtitian opened this issue Apr 29, 2021 · 4 comments Β· Fixed by #54030
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@dragomirtitian
Copy link
Contributor

dragomirtitian commented Apr 29, 2021

Bug Report

πŸ”Ž Search Terms

Depth limit 4.3

πŸ•— Version & Regression Information

  • This changed between versions 4.2 and 4.3

⏯ Playground Link

πŸ’» Code

Happens in a large codebase, I am currently unable to reproduce. The new error appears when a complex mapped & conditional type is used

πŸ™ Actual behavior

Multiple new: error TS2589: Type instantiation is excessively deep and possibly infinite.

πŸ™‚ Expected behavior

Type checks successfully as in 4.2

Note

I bisected and found that this PR is introducing this break. While the behavior outlined there seems to be a net improvement, maybe a solution that doesn't break existing types can be found? Or if not this should be outlined in the 4.3 release notes as a breaking change.

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Apr 29, 2021
@RyanCavanaugh
Copy link
Member

cc @DanielRosenwasser fyi

@dragomirtitian
Copy link
Contributor Author

dragomirtitian commented May 17, 2021

@RyanCavanaugh @DanielRosenwasser I have a repro for the issue. It's not very small but it's the smallest I could get. This works with 4.2 but not 4.3:

Playground Link

@DanielRosenwasser
Copy link
Member

I'll let @RyanCavanaugh re-triage if appropriate, but if there's a good general fix here, it might be good to bring it to 4.3. There might be limitations though, and we might have to consider this "Working as Intended" or "Design Limitation".

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript and removed Needs More Info The issue still hasn't been fully clarified labels May 17, 2021
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.3.2 milestone May 17, 2021
@andykog
Copy link

andykog commented Jun 22, 2021

Here's another repro (smaller than @dragomirtitian's):
Playground link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants