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
interfaceifc{a?:number[]b?:string}letx : ifc={a:[1]};//x.a = [1]; // no error if this line is uncommentedx.a.push(2);// <<<<<<< TS2532: Object is possibly 'undefined'.x.b='aaa';
Expected behavior:
No error with strictNullChecks
Actual behavior:
TS2532: Object is possibly 'undefined'.
Playground Link:
Enable strictNullChecks in options
TypeScript Version: 3.2.0-dev.201xxxxx
Done
Search Terms:
declare variable interface undefined
Code
Expected behavior:
No error with strictNullChecks
Actual behavior:
TS2532: Object is possibly 'undefined'.
Playground Link:
Enable strictNullChecks in options
http://www.typescriptlang.org/play/#src=interface%20ifc%20%7B%0D%0A%20%20%20%20a%3F%3Anumber%5B%5D%0D%0A%20%20%20%20b%3F%3Astring%0D%0A%7D%0D%0A%0D%0Alet%20x%20%3A%20ifc%20%3D%20%7Ba%3A%5B1%5D%7D%3B%0D%0A%2F%2Fx.a%20%3D%20%5B1%5D%3B%20%20%20%20%20%20%20%20%2F%2F%20no%20error%20if%20this%20line%20is%20uncommented%0D%0Ax.a.push(2)%3B%20%20%20%20%20%20%20%20%2F%2F%20%3C%3C%3C%3C%3C%3C%3C%20TS2532%3A%20Object%20is%20possibly%20'undefined'.%0D%0Ax.b%20%3D%20'aaa'%3B
The text was updated successfully, but these errors were encountered: