TypeScript Utility Types Part 3: Extract, Exclude, and NonNullable

TypeScript utility types provide built in type composition tools to generate new types. They capitalize on TypeScript generic types to enable this functionality. In the third part of this series, we will be covering the Extract, Exclude, and NonNullable utilities. For more coverage on other utility types, check out the previous two posts in the series. TypeScript Utility Types Part 1: Partial, Pick, and Omit TypeScript Utility Types Part 2: Record, Readonly, & Required Extract Extract<T, U>. is a utility for pulling out values that are shared between the two type arguments it receives. This can be useful for refining types for other implementations, or to remove types that another implementation may not accept. ...

May 25, 2020 · 5 min · Skyler Lemay

TypeScript Utility Types Part 2: Record, Readonly, & Required

TypeScript utility types provide built in type composition tools to generate new types. They capitalize on TypeScript generic types to enable this functionality. Previously we talked about the Partial, Pick, and Omit types as well as utility types as a concept in part 1 of this series. In this post we will dive into three more of the utility types provided by TypeScript: Record, Readonly, and Required. ...

May 4, 2020 · 5 min · Skyler Lemay

TypeScript Utility Types Part 1: Partial, Pick, and Omit

TypeScript provides multiple means of creating, modifying, and extending existing types into new variants using special utility types. Most of these types utilize generic types under the hood, but a deep understanding of generics is not necessary to utilize them. We can think of utility types as TypeScript functions to return new types. In this post, I’ll cover three of the utility types that I use often as well as some examples of how they can be leveraged. These types include: Partial, Pick, and Omit. ...

April 27, 2020 · 5 min · Skyler Lemay