[TypeScript] Remove a property from a type with Omit

Created on November 30, 2026

You can use the utility type Omit<Type, Keys> to create a type that excludes the specified properties. This example derives User2 from User by removing name.

export class User {
  public name: string;
  public age: number;

  constructor() {
    this.name = '';
    this.age = 0;
  }
}

type User2 = Omit<User, 'name'>;

const user2: User2 = {
  age: 20,
  name: 'Tom',
};

The compiler rejects the name property in the object literal with this diagnostic:

Object literal may only specify known properties, and 'name' does not exist in type 'User2'.

Omit changes a type at compile time. It has no effect on properties of runtime objects.

Reference

TypeScript