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
Issues with inferring from a deeply-recursive type to a deeply-recursive mapped type.
Now a type in the DOM is deeply-recursive.
Part of the issue here is that mapped types try to eagerly operate on array types when they run into them.
We increased our instantiation depth limit from 50 to 500.
On some browsers, that's high enough to cause a stack overflow.
Might have to go back to a depth limit of 100 instead - so how do we keep the same wins from before?
Rewriting type instantiation logic to trampoline is scary.
Quick aside: trampolining in this context is replacing recursion by preserving state across calls, either through continuation passing style and closures or generators and state machines.
One thing we're experimenting with is tail recursion in recursive conditional types.
Have to end in the original type reference.
Now you can write string trimming logic that happily chomps away at whitespace and never takes up any stack space.
Library Reference Overrides / Overrides for
/// <reference lib />#45518
libreferences via the TSConfig #45518) just does atsconfig.jsonoverride./// <reference lib />syntax. There's no way to really get rid of these in the first place."ignore-lib": ["dom"]?"lib": ["!dom"]?-domand!dom./// <reference lib="!dom" />?typesarray.@typescript/es2019)node_modulesideas. @weswigham will need to give some written details on what this looks like.Handling Stack Overflows from Instantiations Across Runtimes
#45576
Have to end in the original type reference.
Now you can write string trimming logic that happily chomps away at whitespace and never takes up any stack space.
"Fails" if your branch ends in a union instead, but users can encode that with an accumulator.