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
The control flow analysis with never return types could be improved.
Consider:
functiontest1_func() : never{throwError("E");}functiontest1(value: "cat"|5){// test1_func never returns so there is no exit from the if code path, // therefore we can assume that value is "cat" after the if.if(value==5)test1_func();returnvalue.length;}
Since test1_func never returns I would expect the type of value at the return statement to be narrowed to "cat".
Consider:
functiontest2_func(){throwError("E");}
I would expect the return type to be deduced as never instead of void.
Finally with a bit better analysis an assert function could be implemented
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
The control flow analysis with never return types could be improved.
Consider:
Since test1_func never returns I would expect the type of value at the return statement to be narrowed to "cat".
Consider:
I would expect the return type to be deduced as never instead of void.
Finally with a bit better analysis an assert function could be implemented
Here since the false value variant never returns, it can be deduced that value must be a number after the call to test3_func.
I though about implementing this my self, but I have no idea of where in the somewhat long cheker.ts.
The text was updated successfully, but these errors were encountered: