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
Array.includes should not be inferring type. Especially when the type is a string and the array is defined by a union of strings.
The point of using includes is to see if something exists in an array. If the thing we are looking for is a string in an array with a union type of strings, we get an error like, "argument of type string is not assignable to parameter of type 'a' | 'b'".
Bug Report
Array.includes should not be inferring type. Especially when the type is a string and the array is defined by a union of strings.
The point of using includes is to see if something exists in an array. If the thing we are looking for is a string in an array with a union type of strings, we get an error like, "argument of type string is not assignable to parameter of type 'a' | 'b'".
🔎 Search Terms
array, includes
🕗 Version & Regression Information
I'm on 4.5.5
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
An error is thrown preventing us from using includes to see if our string is in the array.
🙂 Expected behavior
No error is thrown as we don't know if the string is in the array or not until at runtime.
The text was updated successfully, but these errors were encountered: