export type Apply = A extends B ? A : B extends object ? { [K in Exclude]: A[K]; } & { [K in (keyof A & keyof B) | Exclude]: B[K]; } : A; type SameChecker = (valA: any, valB: any, key: string) => boolean; /** * Returns a clone of original object with only the changed newValues assigned * Returns the original if nothing changed. */ declare function objectUpdate(original: O, newValues: N, customSameCheck?: SameChecker): Apply; type FilterFlags = { [Key in keyof Base]: Cond extends Base[Key] ? Key : never; }; type AllowedNames = FilterFlags[keyof Base]; type NotNull = { [Key in keyof T]: Exclude; }; /** * Makes a derivative of T where all fields that accept `undefined` * (and/or optionally `null`) values are made optional (allowed to be missing). */ type Optionaled = Omit> & Partial : T, AllowedNames>>; /** * Returns a clone of original object with all keys that have undefined values deleted * * Returns the original if nothing changed. */ declare const objectClean: (original: T, alsoNull?: N | undefined) => Optionaled; /** Returns true if object as no properties of its own */ declare const objectIsEmpty: (object: object) => boolean; /** Returns true if objects a and b contain 100% the same values. */ declare function objectIsSame(a: object, b: object, isSame?: SameChecker): boolean; /** * Returns a clone of original object with only the specified keys * Returns the original if nothing changed. */ declare const objectOnly: (original: T, keys: K[]) => Pick; /** * Returns a clone of original object without the specified keys * Returns the original if nothing changed. */ declare const objectWithout: (original: T, keys: K[]) => Omit; /** * Returns original if replacement has the same keys + values. * Otherwise returns replacement as is. */ declare const objectReplace: (original: object, replacement: object, customSameCheck?: SameChecker) => object; export { objectClean, objectIsEmpty, objectIsSame, objectOnly, objectReplace, objectUpdate, objectWithout, };