Skip to main content

omit

Callable

  • omit<T, K>(self: Readonly<T>, keys: readonly K[]): Omit<T, K>

  • Creates a new object by excluding the specified keys from the provided object.

    @example
    const object = { foo: true, bar: true, baz: true };
    omit(object, ['foo']); // { bar: true, baz: true };
    omit(object, ['foo', 'bar']); // { baz: true };
    console.log(object); // > { foo: true, bar: true, baz: true }; (unchanged)

    Type parameters

    • T: object
    • K: string | number | symbol