Solving assertions in TypeScript with Predicates: the runtime-aware Type Guard

  Рет қаралды 127

Atila

Atila

Күн бұрын

Type Predicates are a lesser known pattern, but they are able to provide an incredible boost of developer experience specially when consuming external libraries. Before adding assertions to your code, consider using a Type Guard with predicates instead!
00:00 - Hello
01:15 - Type Assertions may be a bug bomb 🪲
01:45 - Better guards with Predicates instead of Assertions ✨
02:05 - Boolean check + Assertion ⚡️
02:22 - Code setup
02:52 - Default inference - too wide
03:28 - Assertion to the... rescue (?)
03:40 - Oh noes! My assertion is now wrong! 💥
03:58 - Coding the Type Guard ✨
04:46 - Breaking it down one last time
05:08 - Remember to Subscribe 😉

Пікірлер: 1
@X3NOGLADIAT0R850
@X3NOGLADIAT0R850 4 ай бұрын
i havent even encountered this problem im new to ts the reason i clicked is because of goku in the thumbnail
any vs unknown vs never: TypeScript demystified
8:01
Andrew Burgess
Рет қаралды 21 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 168 М.
HAPPY BIRTHDAY @mozabrick 🎉 #cat #funny
00:36
SOFIADELMONSTRO
Рет қаралды 18 МЛН
БАБУШКИН КОМПОТ В СОЛО
00:23
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 13 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 8 МЛН
Doing lists right, the Solid way
11:45
Atila
Рет қаралды 1,3 М.
The Most Legendary Programmers Of All Time
11:49
Aaron Jack
Рет қаралды 539 М.
TypeScript Utility Types You Must Learn
14:07
TomDoesTech
Рет қаралды 17 М.
SolidStart calls for you!
13:56
Atila
Рет қаралды 2,1 М.
Zod makes your content better!
6:26
Atila
Рет қаралды 156
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 254 М.
Absolute speed: SolidJS + Web-Workers
8:31
Atila
Рет қаралды 4 М.