Returns a cloned source object but without specified properties.

TypeScript tip: if you want to omit properties that TS think does not exist in the object, call the function like that:

omit<Record<string, unknown>>(source, ["property"]);
omit({ name: "Jack", age: 69 }, ["age", "title"]);
// { name: "Jack" }
omit(["hello", "world"], [0]);
// { 1: "world" }
  • Type Parameters

    • T extends object
    • K extends string | number | symbol = keyof T

    Parameters

    • object: null | T

      source object

    • props: K[]

      properties to skip

    Returns T extends null
        ? {
            [key: string]: never;
        }
        : Omit<T, K>

    • new object without given properties