Closed
Description
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
Code
export function foo(z: string | null) {
const zConst = z;
if (zConst !== null) {
return {
get bar() {
return zConst.length;
}
}
}
}
Expected behavior:
The code is compiled with "strictNullChecks=true" option as zConst is null-checked and could not be changed.
Actual behavior:
TS is complaining about zConst being possibly null.
The problem seems is relevant to getters only since with the same zConst in a simple function scope it is fine.