正在加载视频...
视频加载失败
🔥 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 次观看 • 3 年前 •via X (Twitter)
10 条评论

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

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

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

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 🤔

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?

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.

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

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

Damn your animator is already working!

just only natural to do a follow up video on Extract<> and Exclude<> 🤞
相关视频
Sensitive content
Kia Noir and Violet Myers are franchise players. Not role players. Not system fits. You build around them. They’re the type you give the max contract to and let them run the offense. Every team in the league wishes they had one.
Vante
2,770,750 次观看 • 1 年前
