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
// @strictNullChecks: truefunctionunknownNarrowing(x: unknown){switch(typeofx){case'function': x;return;// x is unknown, should be Functioncase'object': x;return;// x is unknown, should be object | null}}
Expected behavior:
Narrowing unknown in switch at clause "function" should result in type Function.
Narrowing unknown in switch at clause "object" should result in type object | null.
Actual behavior:
Value of type unknown does not narrow.
Playground Link: N/A (Playground not on this version).
The text was updated successfully, but these errors were encountered:
TypeScript Version: master 83fe1ea
Search Terms: switch typeof unknown
Code
Expected behavior:
unknown
in switch at clause"function"
should result in typeFunction
.unknown
in switch at clause"object"
should result in typeobject | null
.Actual behavior:
unknown
does not narrow.Playground Link: N/A (Playground not on this version).
The text was updated successfully, but these errors were encountered: