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
This is working as intended. Type guards remain in effect across function boundaries only when the guarded variable(s) are considered constant. This is the case for const local variables and parameters that never occur as assignment targets in the function, so if you declare bar using const it works as you expect. See #10357.
TypeScript Version: 2.6.2 | 2.7.0-dev.20180112
Code
Expected behavior:
no errors
Actual behavior:
test.ts(11,20): error TS2532: Object is possibly 'undefined'.
The text was updated successfully, but these errors were encountered: