Exclude Properties from a Type in TypeScript

InstructorKamran Ahmed

Share this video with your friends

Send Tweet

There might be cases where you would want to create a type while excluding some of the properties from a type. Let's say you have a database query on a users table where you are not selecting the password field. In this case, you will not be able to assign the query results to your User type because it is not going to have all the fields available.

In this lesson, we are going to learn how we can use TypeScript's Omit utility type to exclude properties from a type.