-
Notifications
You must be signed in to change notification settings - Fork 13.3k
type checking complexity with multiple template literals in unions #63342
Copy link
Copy link
Open
microsoft/typescript-go
#3331Labels
Domain: check: Big UnionsThe root cause is ultimately that big unions interact poorly with complex structuresThe root cause is ultimately that big unions interact poorly with complex structuresExperimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happensPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases
Metadata
Metadata
Assignees
Labels
Domain: check: Big UnionsThe root cause is ultimately that big unions interact poorly with complex structuresThe root cause is ultimately that big unions interact poorly with complex structuresExperimentation NeededSomeone needs to try this out to see what happensSomeone needs to try this out to see what happensPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases
🔎 Search Terms
template literals, performance
🕗 Version & Regression Information
4.1 introduced template literals where
tscfails withRangeError: Map maximum size exceeded.4.5 is the first version that completes where typechecking time already scales exponentially.
⏯ Playground Link
https://github.com/eps1lon/repro-ts-template-literals-complexity
💻 Code
The example is based on how Next.js typechecks the
hrefin<Link />components.🙁 Actual behavior
Type checking time doubles with every constituent of
DynamicRouteswith template literals🙂 Expected behavior
Type-checking is reasonably fast
Additional information about the issue
No response