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
{{ message }}
Repository navigation
Read-only tuple or Set has wrong types in typescript/lib/lib.es2016.array.include.d.ts #53584
constX=['foo','bar']asconstX.includes('baz')// Argument of type '"baz"' is not assignable to parameter of type '"foo" | "bar"'.(2345)// .includes() checks whether a given item is in the tuple, so disallowing any other elements makes the .includes() function useless since all calls that satisfies the types would return true
🙁 Actual behavior
We cannot check whether elements are included in a read-only tuple.
🙂 Expected behavior
We can check whether elements are not included in a read-only tuple.
changed the title [-]readonly tuple wrong types in typescript/lib/lib.es2016.array.include.d.ts[/-][+]Read-only tuple wrong types in typescript/lib/lib.es2016.array.include.d.ts[/+]on Mar 30, 2023
changed the title [-]Read-only tuple wrong types in typescript/lib/lib.es2016.array.include.d.ts[/-][+]Read-only tuple or Set has wrong types in typescript/lib/lib.es2016.array.include.d.ts[/+]on Mar 30, 2023
Activity
[-]readonly tuple wrong types in typescript/lib/lib.es2016.array.include.d.ts[/-][+]Read-only tuple wrong types in typescript/lib/lib.es2016.array.include.d.ts[/+]MartinJohns commentedon Mar 30, 2023
Duplicate of #14520.
alesmenzel commentedon Mar 30, 2023
Actually there is even better example
Playground
[-]Read-only tuple wrong types in typescript/lib/lib.es2016.array.include.d.ts[/-][+]Read-only tuple or Set has wrong types in typescript/lib/lib.es2016.array.include.d.ts[/+]MartinJohns commentedon Mar 30, 2023
Still a duplicate of the linked issue. :-)
typescript-bot commentedon Apr 2, 2023
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.