Closed
Description
TypeScript Version: 2.4.2
Code
function foo<T>(input: T): T {
if (typeof input === 'number') {
return 10;
}
if (typeof input === 'string') {
return 'Hallo';
}
return input;
}
Expected behavior:
No compiler error.
Actual behavior:
Type '10' is not assignable to type 'T'.
Type '"Hallo"' is not assignable to type 'T'.