TypeScript · Senior · Question 66 of 75
Why can a large union of string literals slow down the compiler?
- ✓Correct answer: Many operations (distribution, template literal combinations, assignability checks) scale with the number of members
- 2Unions are stored as strings
- 3Unions disable caching
Explanation
Prefer string with branded or validated types where unions grow into the thousands; check with --extendedDiagnostics.