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
I'm unsure whether or not it is realistic to improve this. Recently I have been working with a number of A[] | B[] types and noticed that most array operations cannot be done on these.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 3.6.3
Search Terms:
Union type functions
Code
Expected behavior:
No compile error. (
element
is inferred to benumber | string
)Actual behavior:
Compile error. (
Parameter 'element' implicity has 'any' type.
)Playground Link:
http://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=4&pc=1#code/C4TwDgpgBAglC8UB2BXAtgIwgJwNoF0oAfKAZ2GwEskBzAgbgCgBjAeyXKgEMEoAeGAD5cARnxMuAOgBmrbAFEuzABYAKCABsIaCEmAJBUNh1ZbJG1jXVadegJR36UAPTOoObHMZA
Related Issues:
I'm unsure whether or not it is realistic to improve this. Recently I have been working with a number of
A[] | B[]
types and noticed that most array operations cannot be done on these.The text was updated successfully, but these errors were encountered: