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

  • @deepakdonde9199
    @deepakdonde9199 Жыл бұрын

    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.

  • @jesuschristimsmall
    @jesuschristimsmall Жыл бұрын

    hey just wanna say I’m an intern and your video is helping me out sm !

  • @TypeScriptTV

    @TypeScriptTV

    Жыл бұрын

    Niiiiice! I hope you can impress everyone with your new skills! 😀 Best, Benny

  • @cg5td
    @cg5td Жыл бұрын

    This is very helpful, thank you!

  • @TypeScriptTV

    @TypeScriptTV

    Жыл бұрын

    Thank you very much! 😊 I also recently gave a talk about type guards: kzread.info/dash/bejne/fKh90tGPhM27paw.html Best, Benny

  • @tathagat9586
    @tathagat95866 ай бұрын

    Thank you, this is amazing

  • @robertoraul6888
    @robertoraul6888 Жыл бұрын

    Thanks, you're great

  • @TypeScriptTV

    @TypeScriptTV

    Жыл бұрын

    Happy to help! I release new videos every week. 😀 Best, Benny

Келесі