TypeScript Version: 2.9.2
Search Terms: array includes es2016 widen
Code
Array.includes should allow the searchElement param to be a subtype of the array element type, e.g.
typeA='foo'|'bar'|'baz'typeASub=Extract<A,'foo'|'bar'>;declareconstaSubs: ASub[];declareconsta: A;/*Argument of type 'A' is not assignable to parameter of type '"foo" | "bar"'. Type '"baz"' is not assignable to type '"foo" | "bar"'.*/aSubs.includes(a);
Expected behavior:
No error.
TypeScript Version: 2.9.2
Search Terms: array includes es2016 widen
Code
Array.includesshould allow thesearchElementparam to be a subtype of the array element type, e.g.Expected behavior:
No error.