From the course: TypeScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Extending and modifying existing types

Extending and modifying existing types - TypeScript Tutorial

From the course: TypeScript Essential Training

Extending and modifying existing types

- [Instructor] In a previous video, I left you hanging with a type script error that was caused by using the record type to define a query object whose properties were limited to the properties of the same name on the contact type. Now, that worked great to find the property that I previously had defined, which didn't match any of the properties on the contact type. Once I removed that property, however, I faced a new problem. Type script is now yelling at me that I haven't provided values for all of the properties of the contact type. The real problem here, though, is I don't think that this is a problem. I want to choose only a subset of those contact type properties in this query object. In this video, I'll show you a few utility types that allow you to extend from existing types, like record, but pick and choose which properties you want to include and exclude in your new type. First up, let's solve this current…

Contents