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
functionfail(): never{throw'error';}enumE{A,B}functionf(t: E){lets: string;switch(t){caseE.A:
s='a';break;caseE.B:
s='b';break;default:
fail();// but replacing with "throw 'error"' removes the TS error.}s+='';}
Expected behavior:
s += '' is allowed because all terminating (non-throwing) branches assign to s.
In general, I am working under the assumption that calling functions that returning never are equivalent to raw throw calls during control-flow analysis.
Actual behavior:
ERROR(21,3): : Variable 's' is used before being assigned.