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

"Type instantiation is excessively deep and possibly infinite" even for generated non-recursive type #31619

Closed
KSXGitHub opened this issue May 28, 2019 · 7 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@KSXGitHub
Copy link
Contributor

TypeScript Version: 3.4.5

Search Terms:

Code

Expected behavior:

It should work without error

Actual behavior:

ERROR: Type instantiation is excessively deep and possibly infinite

Playground Link:

Related Issues: #30188 (comment)

@fatcerberus
Copy link

Yes, this is known - a conditional type that requires more than 50 steps to instantiate into a concrete type will short out to any, producing the exact error you’ve encountered in the process.

@KSXGitHub
Copy link
Contributor Author

a conditional type that requires more than 50 steps to instantiate into a concrete type will short out to any

The problem wouldn't exist if that "50" number was configurable.

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label May 28, 2019
@fatcerberus
Copy link

Basically a duplicate of #28663, I think?

@AnyhowStep
Copy link
Contributor

AnyhowStep commented May 28, 2019

I had a PR to make it configurable but there's a good reason it isn't configurable. It's an implementation detail, it could change at some point so that the number doesn't make sense, or the meaning of the number becomes different.

Or they might change something so that a number that worked before stops working and you have to bump it up some more.

But what value to use is completely arbitrary and can only really be derived by just... Increasing the number and running the compiler till it works

#29511 (comment)

@nattthebear
Copy link

Even the GitHub syntax highlighting gave up after N extends 222

@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@taxilian
Copy link

I'm seeing this error message in VSCode on lines when running "tsc" from the console (from node_modules/.bin, so same version) is succeeding; I have a case where I legitimately need the depth, though it's definitely less than 50, and I've been trying without success to get rid of the stupid message so I can work again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

7 participants