| 1 | import { Many } from '../_internal/Many.mjs';
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * Creates a new object with specified keys omitted.
|
|---|
| 5 | *
|
|---|
| 6 | * @template T - The type of object.
|
|---|
| 7 | * @template K - The type of keys to omit.
|
|---|
| 8 | * @param {T | null | undefined} object - The object to omit keys from.
|
|---|
| 9 | * @param {...K} paths - The keys to be omitted from the object.
|
|---|
| 10 | * @returns {Pick<T, Exclude<keyof T, K[number]>>} A new object with the specified keys omitted.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * omit({ a: 1, b: 2, c: 3 }, 'a', 'c');
|
|---|
| 14 | * // => { b: 2 }
|
|---|
| 15 | */
|
|---|
| 16 | declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...paths: K): Pick<T, Exclude<keyof T, K[number]>>;
|
|---|
| 17 | /**
|
|---|
| 18 | * Creates a new object with specified keys omitted.
|
|---|
| 19 | *
|
|---|
| 20 | * @template T - The type of object.
|
|---|
| 21 | * @template K - The type of keys to omit.
|
|---|
| 22 | * @param {T | null | undefined} object - The object to omit keys from.
|
|---|
| 23 | * @param {...Array<Many<K>>} paths - The keys to be omitted from the object.
|
|---|
| 24 | * @returns {Omit<T, K>} A new object with the specified keys omitted.
|
|---|
| 25 | *
|
|---|
| 26 | * @example
|
|---|
| 27 | * omit({ a: 1, b: 2, c: 3 }, 'a', ['b', 'c']);
|
|---|
| 28 | * // => {}
|
|---|
| 29 | */
|
|---|
| 30 | declare function omit<T extends object, K extends keyof T>(object: T | null | undefined, ...paths: Array<Many<K>>): Omit<T, K>;
|
|---|
| 31 | /**
|
|---|
| 32 | * Creates a new object with specified keys omitted.
|
|---|
| 33 | *
|
|---|
| 34 | * @template T - The type of object.
|
|---|
| 35 | * @param {T | null | undefined} object - The object to omit keys from.
|
|---|
| 36 | * @param {...Array<Many<PropertyKey>>} paths - The keys to be omitted from the object.
|
|---|
| 37 | * @returns {Partial<T>} A new object with the specified keys omitted.
|
|---|
| 38 | *
|
|---|
| 39 | * @example
|
|---|
| 40 | * omit({ a: 1, b: 2, c: 3 }, 'a', 'b');
|
|---|
| 41 | * // => { c: 3 }
|
|---|
| 42 | */
|
|---|
| 43 | declare function omit<T extends object>(object: T | null | undefined, ...paths: Array<Many<PropertyKey>>): Partial<T>;
|
|---|
| 44 |
|
|---|
| 45 | export { omit };
|
|---|