4 Advanced TypeScript Features - Create Types Dynamically

preview_player
Показать описание
Let's review 4 of the most advanced TypeScript features, that let you automatically generate types on the fly. Instead of creating manually your types, you can use these features to instruct TypeScript on what you want to reuse from your existing types. Did you know that the typeof keyword behaves differently on TypeScript? We will also learn about the keyof operator, lookup types and the keyword infer. Use these features in your generic types, to automate your workflow.

Read the article with the coding examples:

Contents
00:00 Intro
01:49 The typeof keyword
05:15 The keyof keyword
07:19 Lookup Types
08:33 The infer keyword
12:25 Outro

Check out my ✨TypeScript course:

Links mentioned in the video
- My playlist with all the episodes of this series:

This video belongs to my series Too Long To Read TypeScript. Every episode covers in detail a core concept of the language.

❤️ How to support this channel?
- Like this video
- Subscribe to the channel
- Share this video with your friends on social media (only if it helped you)
Рекомендации по теме
Комментарии
Автор

If you have a promise and you want to get the type of the resolved data use Awaited<T> utility type

abulazaiemabas
Автор

feels amazing when the algorithm gives me something super useful! thanks for this, will definitely use what I learned

DrnE
Автор

As a Jr dev looking to improve with TS, this is the best content i've found! Thx a lot Sir 🙏

xav_
Автор

very good video, subbed!
But i think you made a small oopsie at the end of "infer" section by not showing that when you use Flatten on Array<string> the type is "string".

ElektrykFlaaj
Автор

I’m an application developer and I actually use the features quite a bit. I work with a team of people and we typically work on different sections of the application. Dynamic types help keep the code flexible for when one part is integrated into another while still enforcing a type. It certainly better than const myVariable: {}

eqprog
welcome to shbcf.ru