-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Array Type Inference #29163
Comments
Known issue - array literals are inferred as a union of their member types. I don't think it's considered a bug. |
I see. I looked through the FAQ pages of other bugs and did not find exactly equivalent. I'll let them close this if this is desired behavior. I'm curious what reasons there are for this not being the desired behavior! |
Aye, the two links @fatcerberus has - #27179 and #16656 are where this problem is being discussed. |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
TypeScript Version: 3.3.0-dev.20181222
Search Terms:
Code
Playground Link
Expected behavior:
TypeScript infers type of
array
as[string, number]
.Actual behavior:
TypeScript infers type of
array
as(string | number)[]
.Related Issues:
#25516
The text was updated successfully, but these errors were encountered: