TypeScript Utility Types: Omit and Pick

preview_player
Показать описание
#shorts

Here's a brief guide on two of TypeScript's utility types - Omit and Pick.

Become a TypeScript Wizard with Matt's upcoming TypeScript Course:

Follow Matt on Twitter

Рекомендации по теме
Комментарии
Автор

This is where small short videos belong 🎉 well done Matt

hugodsa
Автор

I use Omit, Pick, Required, and Partial ALL the time. Really useful.

ShotgunAFlyboy
Автор

I use a custom omit and pick to
CustomPick<T, U extends keyof T> = Pick<T, U> so you can only choose from valid keys

brucewayne
Автор

Thanks for such a clear explanation Matt!

vedantnn
Автор

Wow. This is awesome. What I’ve always done is create the type with the limited properties first, then create the second class that extends it with the extra details.

I love this

josephajibodu
Автор

video edit style is very nice. thanks…

akgul
Автор

What an excellent explanation! Thanks!

csoto
Автор

Your tutorial is super readable and understandable. What VScode extensions do you use when you make videos? I like the animation 😂😂

cvkfbkq
Автор

woww, what tools you use to produce this animation coding video? Btw your typescript contents are amazing and very helpful

DioArsya
Автор

Can we do this with array? because technically an array is also an object?

anhdunghisinh
Автор

Sorry, could you please tell what vscode theme you are using?)

islombekdev
Автор

I don't know why, I just can't get my head around these new animations you're using. So hard for me to follow for some reason.

samautrey
Автор

"manipulate objects"? so I can throw out lodash pick/omit, delete, spread in destructuring to actually omit props from objects etc? uh-huh

banshee
Автор

Let me do one better.

type PartialRequire<T, K extends keyof T> =
Pick<T, K> & Partial<Omit<T, K>>;
type UserWithOnlyEmailRequired =
PartialRequire<User, "email">;

Give you a type that looks like:

type UserWithOnlyEmailRequired =
{ id?: string;
email: string;
postCount?: number; }

codeman-dev
visit shbcf.ru