-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'production' into rewrite-types
- Loading branch information
Showing
4 changed files
with
1,225 additions
and
1,059 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import { O } from 'ts-toolbelt'; | ||
declare type ExpandDeep<T> = T extends Record<string | number | symbol, unknown> ? { | ||
[K in keyof T]: ExpandDeep<T[K]>; | ||
} : T extends Array<infer E> ? Array<ExpandDeep<E>> : T; | ||
/** | ||
* Merge anything recursively. | ||
* Objects get merged, special objects (classes etc.) are re-assigned "as is". | ||
* Basic types overwrite objects or other basic types. | ||
* @param object | ||
* @param otherObjects | ||
*/ | ||
export declare function merge<T extends Record<string, any>, Tn extends Record<string, any>[]>(object: T, ...otherObjects: Tn): O.Assign<T, Tn, 'deep'>; | ||
export declare function mergeAndCompare<T extends Record<string, any>, Tn extends Record<string, any>[]>(compareFn: (prop1: any, prop2: any, propName: string | symbol) => any, object: T, ...otherObjects: Tn): O.Assign<T, Tn, 'deep'>; | ||
export declare function mergeAndConcat<T extends Record<string, any>, Tn extends Record<string, any>[]>(object: T, ...otherObjects: Tn): O.Assign<T, Tn, 'deep'>; | ||
export declare function merge<T extends Record<string, any>, Tn extends Record<string, any>[]>(object: T, ...otherObjects: Tn): ExpandDeep<O.Assign<T, Tn, 'deep'>>; | ||
export declare function mergeAndCompare<T extends Record<string, any>, Tn extends Record<string, any>[]>(compareFn: (prop1: any, prop2: any, propName: string | symbol) => any, object: T, ...otherObjects: Tn): ExpandDeep<O.Assign<T, Tn, 'deep'>>; | ||
export declare function mergeAndConcat<T extends Record<string, any>, Tn extends Record<string, any>[]>(object: T, ...otherObjects: Tn): ExpandDeep<O.Assign<T, Tn, 'deep'>>; | ||
export {}; |
Oops, something went wrong.