TypeScript Version: 2.7.0-dev.20171229
Code
// tsc --strict --noEmit test.ts
declare const throwError: () => never
declare const obj: { prop?: number }
if (!obj.prop) {
throwError()
}
obj.prop.toFixed(1) // error TS2532: Object is possibly 'undefined'.
Expected behavior:
At the last line obj.prop is number, not undefined
Actual behavior:
At the last line obj.prop is possibly undefined
TypeScript Version: 2.7.0-dev.20171229
Code
Expected behavior:
At the last line
obj.propis number, not undefinedActual behavior:
At the last line
obj.propis possibly undefined