You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Compile with --strictinterfaceIFoo{a?: number[],}letfoo: IFoo={a: []};// error: Object is possible 'undefined'foo.a.push(4);// this will work// foo.a = [];// foo.a.push(5) // no errors// alternatively,foo!.a.push(3);
Expected behavior:
The compiler should be able to infer using the object initialization that foo.a is defined.
Actual behavior:
The compiler ignores the initialization of property 'a'.
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 2.8.1
Code
Expected behavior:
The compiler should be able to infer using the object initialization that foo.a is defined.
Actual behavior:
The compiler ignores the initialization of property 'a'.
Playground Link: Playground link (use strict check in options)
Related Issues:
The text was updated successfully, but these errors were encountered: