-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Hex Colors error with TS2590: Expression produces a union type that is too complex to represent #59015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems that the maximum states that union can represent is |
Duplicate of #43388.
The limit is 25, and that's intentional. |
I searched for 25, and can't seem to find where this limitation actually is. Is it possible to submit a PR to increase that value ? |
25 is from #30779 but that doesn't seem to be related to this. The limit here is on the order of 10^5, and if you are trying to write a union bigger than that then you're doing something TS doesn't want you to do. The limit is there for performance so I'm sure they're not going to increase it to some large number just because the number can be represented easily. |
The limit is in place to stop your typechecking from taking six hours, not because we don't have access to 31 bits worth of integer 😉 |
I see, thank you. In my case the only thing I can really do then is to perform some analysis during compile time, and/or hope for #43335 to be accepted |
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
🔎 Search Terms
ts(2590)
,Expression produces a union type that is too complex to represent.
,HexTypes
🕗 Version & Regression Information
This is an error that typescript throws when I try to build it, as well as the LSP complains. It raises the error
ts(2590)
,Expression produces a union type that is too complex to represent
⏯ Playground Link
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAEhAeBhAFgQwE5QLxQEQAZcoAfPARiNNwCZK8BmO3AFiYFYmA2JgdiYA4mATiYBBJgCEmiJgBEmAUSYAxXAG4AUKEiwE9RAHsANgcw4ABgGIAJAG84SNOgC+dhygyv7CDy-ObtaAdOQxMzKCs3Hycvdxiox08E31jopO9EvwDwIIR+UNNsCJsMlOT40oq49OqXcpq0usrPfw0NBDBTYChA3SRjQpwHfQHMUmCCsb780bUgA
💻 Code
🙁 Actual behavior
The type of
HexColor
should be well defined and accessible. As well as there shouldn't be any errors.🙂 Expected behavior
The type of
HexColor
isany
, and there are errors.Additional information about the issue
It seems that also Deno is affected (I first discovered it using Deno). I tried switching to plain TS, still raises errors.
The text was updated successfully, but these errors were encountered: