uft
    Preparing search index...

    Function omit

    • Creates a new object by copying all the keys from the given object, excluding those specified.

      Type Parameters

      • T extends object
      • K extends string

      Parameters

      • obj: T

        The object to copy.

      • keys: K[]

        The keys that should not be copied.

      Returns Omit<T, K | CoerceNumber<K>>

      A new object without the given keys.

      const obj = { a: 1, b: 2, c: 3 }
      const newObj = omit(obj, ['b', 'c']) // type: { a: number }

      console.log(newObj) // prints: { a: 1 }
    • Creates a new object by copying all the keys from the given object, excluding those specified.

      Type Parameters

      • T extends object

      Parameters

      • obj: T

        The object to copy.

      • keys: string[]

        The keys that should not be copied.

      Returns Record<string, T[keyof T]>

      A new object without the given keys.

      const obj = { a: 1, b: 2, c: 3 }
      const newObj = omit(obj, ['b', 'c']) // type: { a: number }

      console.log(newObj) // prints: { a: 1 }