TypeScript Version: 2.1.4 (2.2.0-dev.20161218 also)
Code
With --strictNullChecks,
interfaceFoo{prop: string;}functionnullableFooPromise(): Promise<Foo|null>{returnPromise.resolve(null);}nullableFooPromise().then(nullableFoo=>nullableFoo ? nullableFoo : {prop: 'foo'}).then(foo=>console.log(foo.prop));// this line raises an errorExpected behavior:
I expect this to compile (it does actually when I use typescript@2.0.8).
Actual behavior:
I get an error,
index.ts(11,28): error TS2531: Object is possibly 'null'.
TypeScript Version: 2.1.4 (2.2.0-dev.20161218 also)
Code
With --strictNullChecks,
Expected behavior:
I expect this to compile (it does actually when I use typescript@2.0.8).
Actual behavior:
I get an error,
index.ts(11,28): error TS2531: Object is possibly 'null'.