-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add type support for older TypeScript versions
- Loading branch information
Rebecca Stevens
committed
Nov 16, 2020
1 parent
d21f41a
commit b00128c
Showing
3 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
dist/* | ||
types/* | ||
!types/legacy* |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Deeply merge two objects. | ||
* | ||
* @param target The first object. | ||
* @param source The second object. | ||
* @param options Deep merge options. | ||
*/ | ||
export default function deepmerge<T1 extends object, T2 extends object>(target: T1, source: T2, options?: Options): T1 & T2; | ||
|
||
/** | ||
* Deeply merge two or more objects. | ||
* | ||
* @param objects An tuple of the objects to merge. | ||
* @param options Deep merge options. | ||
*/ | ||
export function deepmergeAll<T1 extends object, T2 extends object>(objects: [T1, T2], options?: Options): T1 & T2; | ||
export function deepmergeAll<T1 extends object, T2 extends object, T3 extends object>(objects: [T1, T2, T3], options?: Options): T1 & T2 & T3; | ||
export function deepmergeAll<T1 extends object, T2 extends object, T3 extends object, T4 extends object>(objects: [T1, T2, T3, T4], options?: Options): T1 & T2 & T3 & T4; | ||
export function deepmergeAll<T1 extends object, T2 extends object, T3 extends object, T4 extends object, T5 extends object>(objects: [T1, T2, T3, T4, T5], options?: Options): T1 & T2 & T3 & T4 & T5; | ||
export function deepmergeAll<T extends object>(objects: ReadonlyArray<T>, options?: Options): T; | ||
|
||
/** | ||
* Deep merge options. | ||
*/ | ||
export type Options = { | ||
arrayMerge?: (target: object[], source: object[], options: Options) => any; | ||
clone?: boolean; | ||
customMerge?: (key: string) => ((target: object, source: object, options: Options) => any) | undefined; | ||
isMergeable?: (value: object) => boolean; | ||
} |