Closed
Description
TypeScript Version: 2.7.0-dev.20171116
Code
const func1 = <T extends (string | number)>(key: string, data: T | T[]): void => {};
const func2 = <T extends (string | number | boolean)>(key: string, data: T | T[]): void => {};
func1("data", ["value"]);
// OK
func2("data", [123, 345]);
// OK
func2("data", [false, true]);
// OK
func2("data", ["123", true]);
// OK
func2("data", ["123"]);
// Argument of type 'string[]' is not assignable to parameter of type '"value" | "value"[]'.
// Type 'string[]' is not assignable to type '"value"[]'.
// Type 'string' is not assignable to type '"value"'.
Expected behavior:
Code compiles without errors.
Actual behavior:
Code compiles with error.
BUT: with typescript@2.6.1 there is no error.