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
constmain=()=>{lethoge: string|undefined=undefined;try{hoge='hoge!';return;// Bug disappears after removing this return.}catch{return;// Bug disappears after removing this return.}finally{if(hoge){hoge.length;}return;}}main();
Expected behavior:
In finally block, hoge's type is string | undefined
Actual behavior:
In finally block, hoge's type is only undefined, and Property 'length' does not exist on type 'never'. error occured.
TypeScript Version: 3.7.2
Search Terms: try catch finally return
Code
Expected behavior:
In
finally
block,hoge
's type isstring | undefined
Actual behavior:
In
finally
block,hoge
's type is onlyundefined
, andProperty 'length' does not exist on type 'never'.
error occured.Playgroung Link
Related Issues:
The text was updated successfully, but these errors were encountered: