ts-type-forge
    Preparing search index...

    Type Alias DeepOmit<T, Path>

    DeepOmit: {
        [K in keyof T as K extends DeepOmitLeafKeys<Path> ? never : K]: DeepOmitValue<
            T[K],
            DeepPickOmitTail<Path, K>,
        >
    }

    Deeply omits a nested property from an object type along the specified key path. Supports union of paths to omit multiple nested properties. When one path is a prefix of another (e.g., ['a'] | ['a', 'b']), the shorter path takes precedence and the entire subtree is removed.

    Type Parameters

    • T

      The object type to omit from.

    • Path extends readonly PropertyKey[]

      A tuple representing the key path, or a union of such tuples.

    A new object type with the properties along the specified path(s) removed.

    type Data = { a: { b: { c: number; d: string } }; e: boolean };
    type Omitted = DeepOmit<Data, ['a', 'b', 'c']>;
    // Result: { a: { b: { d: string } }; e: boolean }

    type Multi = DeepOmit<Data, ['a', 'b'] | ['a', 'c']>;
    // Result: { a: { d: boolean } }