Constructs a new type from T by omitting K from the non-null and non-undefined type of T and preserves null and undefined as union types if they were part of the original union.
T
K
null
undefined
type User = { id: string; name: string;}type Post = { title: string; body: string; author: User | null;}NullableOmit<Post["author"], "id">; // Omit<User, "id"> | null Copy
type User = { id: string; name: string;}type Post = { title: string; body: string; author: User | null;}NullableOmit<Post["author"], "id">; // Omit<User, "id"> | null
Constructs a new type from
Tby omittingKfrom the non-null and non-undefined type ofTand preservesnullandundefinedas union types if they were part of the original union.