Closed
Description
Hi, don't understand why this code doesn't compile:
function f<T>(value: [string, T]): T {
return value[1];
}
var h: boolean = f(["string", true]);
error TS2323: Type 'string | boolean' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
Someone can help me ?