TypeScript Version: 3.4.5
Search Terms:
Code
git clone https://gist.github.com/b1ddd0b8c68889622794804931c222cd.git tmpdir
cd tmpdir
sh test.sh
Expected behavior:
It should work without error
Actual behavior:
ERROR: Type instantiation is excessively deep and possibly infinite
Playground Link:
Related Issues: https://github.com/microsoft/TypeScript/issues/30188#issuecomment-484499108
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鈥檝e encountered in the process.
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.
Basically a duplicate of #28663, I think?
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
https://github.com/microsoft/TypeScript/issues/29511#issuecomment-458620791
Even the GitHub syntax highlighting gave up after N extends 222
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
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
Most helpful comment
The problem wouldn't exist if that "50" number was configurable.