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
consta=(s: string)=>{}constb=(s: string|number)=>{s="";return;a(s);// <- Error occurs here (type 'number' is not assignable to type 'string')}constc=(s: string|number)=>{s="";a(s);// <- No error here}
π Actual behavior
On the line a(s); in the function b:
Argument of type 'string | number' is not assignable to parameter of type 'string'.
Type 'number' is not assignable to type 'string'.
Type error is thrown even though s is reassigned as a string before the call.
π Expected behavior
No type error.
Without the return, as in the function c, everything works as expected.
Not sure whether this is intended or not, but seems like a bug to me. Thanks!
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
π Version & Regression Information
return
β― Playground Link
Playground Link
π» Code
π Actual behavior
On the line
a(s);
in the functionb
:Type error is thrown even though
s
is reassigned as astring
before the call.π Expected behavior
No type error.
Without the
return
, as in the functionc
, everything works as expected.Not sure whether this is intended or not, but seems like a bug to me. Thanks!
The text was updated successfully, but these errors were encountered: