mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Added definitions for KyleAMathews/deepmerge (#13752)
This commit is contained in:
parent
7f88646e17
commit
fc5b949e78
13
deepmerge/deepmerge-tests.ts
Normal file
13
deepmerge/deepmerge-tests.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import * as deepmerge from "deepmerge";
|
||||
|
||||
const x = { foo: { bar: 3 },
|
||||
array: [ { does: 'work', too: [ 1, 2, 3 ] } ] }
|
||||
const y = { foo: { baz: 4 },
|
||||
quux: 5,
|
||||
array: [ { does: 'work', too: [ 4, 5, 6 ] }, { really: 'yes' } ] }
|
||||
|
||||
const expected = { foo: { bar: 3, baz: 4 },
|
||||
array: [ { does: 'work', too: [ 1, 2, 3, 4, 5, 6 ] }, { really: 'yes' } ],
|
||||
quux: 5 }
|
||||
|
||||
const result = deepmerge<Object>(x, y);
|
||||
17
deepmerge/index.d.ts
vendored
Normal file
17
deepmerge/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for deepmerge 1.3
|
||||
// Project: https://github.com/KyleAMathews/deepmerge
|
||||
// Definitions by: marvinscharle <https://github.com/marvinscharle>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = deepmerge;
|
||||
|
||||
declare function deepmerge<T>(x: T, y: T, options?: deepmerge.Options<T>): T;
|
||||
|
||||
declare namespace deepmerge {
|
||||
interface Options<T> {
|
||||
clone?: boolean;
|
||||
arrayMerge?: (destination: T, source: T, options?: Options<T>) => T;
|
||||
}
|
||||
|
||||
function all<T>(objects: T[], options?: Options<T>): T;
|
||||
}
|
||||
20
deepmerge/tsconfig.json
Normal file
20
deepmerge/tsconfig.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"deepmerge-tests.ts"
|
||||
]
|
||||
}
|
||||
1
deepmerge/tslint.json
Normal file
1
deepmerge/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Loading…
Reference in New Issue
Block a user