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
try{// ...}catch(e: unknown){// error!// Property 'toUpperCase' does not exist on type 'unknown'.console.log(e.toUpperCase());if(typeofe==="string"){// works!// We've narrowed 'e' down to the type 'string'.console.log(e.toUpperCase());}}
It would be good to consider these typed/safe (even when --ignore-catch is false).
In TypeScript 4.0 we can finally treat caught exceptions as
unknown
instead ofany
.From https://devblogs.microsoft.com/typescript/announcing-typescript-4-0-beta/#unknown-on-catch:
It would be good to consider these typed/safe (even when
--ignore-catch
is false).See also
The text was updated successfully, but these errors were encountered: