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
interface FOO {
[key:string]: number
}
declare var foo: FOO | null
if(foo) {
var a = foo['string'] // good
Object.keys(foo).map(key => {
var b = foo[key] // foo cannot possibly be null
})
}
//related
foo && foo['string'] && Object.keys(foo).map(key => {
var a = foo[key] // foo cannot possibly be null
})
Expected behavior:
Should know Object is not 'null'
TypeScript Version: 3.5.1
Search Terms: Type Guard
Expected behavior:
Should know Object is not 'null'
Actual behavior:
Thinks Object is possibly 'null'
Playground Link: ts-playground
Related Issues:
The text was updated successfully, but these errors were encountered: