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
Search Terms:
strictNullChecks, switch, case, condition, if, variable is used before being assigned.
Code
constenumTest{A,B}functiontest(x: Test){letbork: string;switch(x){caseTest.A: {bork='a';break;}caseTest.B: {bork='b';break;}}returnbork;// ^^^^// Variable 'bork' is used before being assigned.}
Expected behavior:
No errors here.
TS should know about all possible checks. Right now we can get some kind of error: Not all code paths return a value. in cases when we didn't define all possible cases or when default has been omited.
Actual behavior:
We got an error Variable is used before being assigned. It also happens with if-else-if variant.