TypeScript Type Guards Explained

  Рет қаралды 9,092

Software Developer Diaries

Software Developer Diaries

Жыл бұрын

TypeScript tutorial on how to use Guards such as typeof, instanceof, in and user-defined TypeScript Guards.
======⚡⚡⚡======
Consider supporting the channel by clicking the "Thanks" button ❤️
👉 Get a 20% discount on Brilliant.org (to learn Science, Technology, Engineering, and Math): brilliant.sjv.io/kjVO2z
======⚡⚡⚡======
🙌 Become my Patreon and get exclusive perks: / softdevdiaries
💼 Follow me on LinkedIn and drop me a message if you'd like: / gusgadirov
💻 Also, let's connect on GitHub: github.com/gusgad
📚 Resources:
TypeScript predicates: www.typescriptlang.org/docs/h...
And don't forget to subscribe for more videos like this 😊

Пікірлер: 6
@sandorturbucz425
@sandorturbucz425 10 ай бұрын
This is one of the smarter aspects of using TS, good explanation. Some small side note, at 4:40 in real life we probably should use (unless it's on purpose) Object.hasOwn() instead of in, because the latter also finds the properties through the prototype chain.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 10 ай бұрын
Great point!
@fusion.chronicles
@fusion.chronicles 17 күн бұрын
The best explanation so far 👍
@jvsvogler
@jvsvogler Жыл бұрын
Really helpful, thanks a ton!
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Glad it helped!
@rajsatraroxor9603
@rajsatraroxor9603 Ай бұрын
In last example, while changing from fruit instanceof to isTasty in, last keyword "Banana" should be changed to parameter "fruit", to check isTasty exisits or not in fruit which is passed into that function
TypeScript Generics: All You Need to Know
7:52
Software Developer Diaries
Рет қаралды 4,8 М.
7 TypeScript DOs and DON'Ts That You Should Be Aware Of
14:07
Software Developer Diaries
Рет қаралды 4,6 М.
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 21 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 25 МЛН
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 15 МЛН
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 20 МЛН
TypeScript #5 - Type Assertions
1:54
Project Brackets
Рет қаралды 4,5 М.
Infer is easier than you think
13:38
Matt Pocock
Рет қаралды 87 М.
any vs unknown vs never: TypeScript demystified
8:01
Andrew Burgess
Рет қаралды 21 М.
The TRUTH About TypeScript Enums
12:04
James Q Quick
Рет қаралды 6 М.
Utility Types - Advanced TypeScript
35:33
Dmytro Danylov
Рет қаралды 68 М.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Рет қаралды 197 М.
as const: the most underrated TypeScript feature
5:38
Matt Pocock
Рет қаралды 114 М.
7 Awesome TypeScript Types You Should Know
8:57
Josh tried coding
Рет қаралды 79 М.
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 440 М.
Сколько реально стоит ПК Величайшего?
0:37
Копия iPhone с WildBerries
1:00
Wylsacom
Рет қаралды 6 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 2,3 МЛН