Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

🔥 TypeScript Tip 🔥 Omit and Pick are the gateway to understanding type-level programming. They let you start deriving types, instead of redeclaring them.

232,311 görüntüleme • 3 yıl önce •via X (Twitter)

10 Yorum

Fernando Rojo profil fotoğrafı
Fernando Rojo3 yıl önce

i like combining them to add type suggestions to Omit itself: type Omitted = keyof Pick<User, ‘role’> type WithoutRole = Omit<User, Omitted>

Matt Pocock profil fotoğrafı
Matt Pocock3 yıl önce

Or type StrictOmit<T, K extends keyof T> = Omit<T, K>;

Sumit | Frontend profil fotoğrafı
Sumit | Frontend3 yıl önce

Which tool do you use to edit these videos? 🥺🥺🥺 please Matt

calebcodes profil fotoğrafı
calebcodes3 yıl önce

Very interesting. Any reason to prefer one of these over "traditional" inheritance (extending interfaces to add fields)? I can see how there are some semantic benefits to Pick/Omit, but I wonder if they'd lead to some bad practices from an OOP perspective 🤔

Roman Holubenko profil fotoğrafı
Roman Holubenko3 yıl önce

Very useful, but now I have a question: what better way to structure types on the project would you suggest? Making a single file named "types" and export all needed types from there, or writing types inside working files where you use them?

Jimmy Thompson profil fotoğrafı
Jimmy Thompson3 yıl önce

Definitely a powerful tool, but should be used with care IMO. These patterns crept into our codebase and caused an explosion in types, each used only once. As much as types are for type safety, they're to help you describe your domain. Meaningless types are as bad as no types.

Uberto Barbini @ramtop.bsky.social profil fotoğrafı
Uberto Barbini @ramtop.bsky.social3 yıl önce

I wish we could do something like this in kotlin... :(

fuko profil fotoğrafı
fuko3 yıl önce

short and sweet! I particularly love this format, thanks for the vid! 😊

harpaljadeja.eth (evm/acc) 🇮🇳 profil fotoğrafı
harpaljadeja.eth (evm/acc) 🇮🇳3 yıl önce

Damn your animator is already working!

Edun Omatseye 🔥 profil fotoğrafı
Edun Omatseye 🔥3 yıl önce

just only natural to do a follow up video on Extract<> and Exclude<> 🤞

Benzer Videolar