Closed
Description
TypeScript Version: 2.0.0-dev.20160704
Code
const x : { readonly a: string | undefined } = { a: 's' };
if (typeof x.a !== 'undefined') {
() => x.a.length;
}
Expected behavior:
x.a.length
should be valid, since x.a is in a typeguard, x is constant, and x.a is readonly, and thus value of x.a cannot change even when the function is called at a later time.
Actual behavior:
[ts] Object is possibly 'undefined'.
(property) a: string | undefined