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
interfaceA{arrayOfB?: B[];}interfaceB{prop: number;}varobj: {[name: string]: A}={};for(letnameinobj){if(obj[name].arrayOfB){// make sure that obj[name].arrayOfB is not undefinedfor(letbinobj[name].arrayOfB){// error in 'obj[name].arrayOfB': [ts] Object is possibly 'undefined'.}}// in this way it is ok, no errorsletarrayOfB=obj[name].arrayOfB||[];for(letbinarrayOfB){}}
Expected behavior:
Infer that obj[name].arrayOfB is of type B[]
Actual behavior:
Considering obj[name].arrayOfB of type B[]|undefined
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.6.0-dev.20171015
Code
Expected behavior:
Infer that
obj[name].arrayOfB
is of typeB[]
Actual behavior:
Considering
obj[name].arrayOfB
of typeB[]|undefined
The text was updated successfully, but these errors were encountered: