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
Expected behavior:
No error, just as if return; were not present
Actual behavior:
The terminating condition fails to narrow the type for the increment clause:
Property 'toUpperCase' does not exist on type 'string | number'.
I suspect this happens because exiting the loop early (especially with break; means that the narrowing doesn't apply after the loop body.
However, that's never true for the increment clause.
TypeScript Version: 3.8.0-dev.20200107 (nightly on Playground
Search Terms: for return loop
Code
Expected behavior:
No error, just as if
return;
were not presentActual behavior:
The terminating condition fails to narrow the type for the increment clause:
I suspect this happens because exiting the loop early (especially with
break;
means that the narrowing doesn't apply after the loop body.However, that's never true for the increment clause.
Playground Link: link
Related Issues: None
The text was updated successfully, but these errors were encountered: