Im wondering, how is this code giving object is possibly undefined error
if (newFocus) {
if (viewCache[viewId] !== undefined) {
dispatch(ViewActions.focusOn(viewCache[viewId].focus));
} else {
dispatch(ViewActions.focusOn(newFocus));
}
}
and line 3 is giving me error, viewCache[viewId] is possibly undefined
even when wrapped in if (viewCache[viewId] !== undefined)