Better error handling with unknown type in TypeScript
Ғылым және технология
Improve your error handling in catch clauses by using TypeScript's unknown type.
My FREE programming apps:
- apps.apple.com...
- play.google.co...
My FREE TypeScript Course:
- typescript.tv/
Timeline:
00:00 Typing errors in try-catch
01:35 Type Guard Definition
01:55 instanceof Type Guard
02:17 Handle custom errors
04:30 typeof Type Guard
05:26 in Type Guard
06:36 Custom Type Guard
09:41 any vs. unknown
10:01 Compiler option for unknown
Code:
➜ gist.github.co...
Resources:
➜ typescript.tv/...
➜ www.typescript...
Follow TypeScript TV:
🌐 typescript.tv
🐦 / typescripttv
📺 / typescripttv
Hashtags:
#TypeScript #JavaScript #Programming
Пікірлер: 8
This is really helpful...strict typecheck makes it difficult when return type does not match I wonder what to do if we are not sure whether function return either a value or error and we need to accept and process either one of them.
hey just wanna say I’m an intern and your video is helping me out sm !
@TypeScriptTV
Жыл бұрын
Niiiiice! I hope you can impress everyone with your new skills! 😀 Best, Benny
This is very helpful, thank you!
@TypeScriptTV
Жыл бұрын
Thank you very much! 😊 I also recently gave a talk about type guards: kzread.info/dash/bejne/fKh90tGPhM27paw.html Best, Benny
Thank you, this is amazing
Thanks, you're great
@TypeScriptTV
Жыл бұрын
Happy to help! I release new videos every week. 😀 Best, Benny