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
{{ message }}
Repository navigation
Assign to union with over 25 items gives errorΒ #43283
We don't plan to change this. There are a decent number of cases where we try this structural expansion but it doesn't work, so limiting the cost of that happening is important.
It will be good if there will be right error about this limit, not incompatible error
It's not clear how to do this. "It's possible that a finite expansion of all possible inhabitants of each type may result in a subset" is going to be true a decent amount of time yet would be very confusing.
It will be good if there will be right error about this limit, not incompatible error
It's not clear how to do this. "It's possible that a finite expansion of all possible inhabitants of each type may result in a subset" is going to be true a decent amount of time yet would be very confusing.
Ryan Cavanaugh (@RyanCavanaugh) right now the error message is very confusing. The compiler should output in error message that the hardcoded limit is reached.
Activity
[-]Union with over 25 items gives error[/-][+]Assign to union with over 25 items gives error[/+]MartinJohns commentedon Mar 17, 2021
Duplicate of #40803. Used search terms:
union 25. I also found this issue using your search terms:big union.This is a hard coded intentional limit.
MrNovado commentedon Mar 17, 2021
Martin Johns (@MartinJohns) Thanks! Is there any known and accepted workaround for this? And are there any plans to up the limit in the near future?
MartinJohns commentedon Mar 17, 2021
I don't know of any workaround, and I'm not aware of any plans to increase this limit. But that would be up to the TypeScript team, of course.
A good idea is to subscribe to the existing issue, so you get notified if something is changing.
RyanCavanaugh commentedon Mar 17, 2021
We don't plan to change this. There are a decent number of cases where we try this structural expansion but it doesn't work, so limiting the cost of that happening is important.
cevek commentedon Mar 17, 2021
It will be good if there will be right error about this limit, not incompatible error
RyanCavanaugh commentedon Mar 17, 2021
It's not clear how to do this. "It's possible that a finite expansion of all possible inhabitants of each type may result in a subset" is going to be true a decent amount of time yet would be very confusing.
jogibear9988 commentedon Mar 19, 2021
Wouldn't it be desiarable to add a tsconfig parameter for the limit?
typescript-bot commentedon Mar 22, 2021
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
denbkh commentedon Oct 7, 2025
Ryan Cavanaugh (@RyanCavanaugh) right now the error message is very confusing. The compiler should output in error message that the hardcoded limit is reached.
RyanCavanaugh commentedon Oct 7, 2025
Denis Bakharev (@denbkh) you would see that error all the time in cases where even if the limit were Infinity, the assignment would still fail