Closed
Description
TypeScript Version: master
Search Terms:
Code
function f<T extends undefined | object>(o: T): T {
return o!;
}
An argument o?: T
is T | undefined
but o!
isn't T
.
Expected behavior:
pass
Actual behavior:
$ node built/local/tsc.js --noEmit --strictNullChecks index.ts
index.ts(2,3): error TS2322: Type 'object' is not assignable to type 'T'.
Related Issues: