Hex Core JS
    Preparing search index...

    Type Alias NullableOmit<T, K>

    NullableOmit:
        | Omit<Exclude<T, null | undefined>, K>
        | (T extends null ? null : never)
        | (T extends undefined ? undefined : never)

    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.

    Type Parameters

    • T
    • K extends keyof Exclude<T, 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