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
types that are unions of two types of arrays, ie string[] | number[] will make the find method go from a method to a field.
For the record, that’s not what’s happening here at all.
Each member of the union type … has signatures, but none of those signatures are compatible with each other.
Basically, TS doesn’t know whether to use the find from string[] or the one from number[], and isn’t able to unify them because they have conflicting requirements.
Bug Report
types that are unions of two types of arrays, ie
string[] | number[]
will make thefind
method go from amethod
to afield
.if type is just
string[]
or if i type it asnumber[]
or if i type it by(string | number)[]
in the example below find is amethod
.🔎 Search Terms
find array method
🕗 Version & Regression Information
Started seeing it today
⏯ Playground Link
TSPlayground Example
💻 Code
🙁 Actual behavior
TSC has hurt feelings (build fails)
🙂 Expected behavior
TSC says this is great (just like
map
, or other array methods)The text was updated successfully, but these errors were encountered: