Omit<T, K>
Constructs a type by removing the set of properties K from T.
Syntax
Omit<Type, Keys> Returns
object type — A type with all properties of T except those whose keys are in K.
Examples
interface User {
id: number;
name: string;
password: string;
}
type PublicUser = Omit<User, 'password'>;
const u: PublicUser = { id: 1, name: 'Ada' };
type WithoutId<T> = Omit<T, 'id'>;
Notes
Implemented as `Pick<T, Exclude<keyof T, K>>`. Unlike `Pick`, K is not
constrained to `keyof T`, so misspelled keys are silently ignored. It is not
distributive over union members; wrap in a custom distributive type if needed.