Added definitions for KyleAMathews/deepmerge (#13752)

This commit is contained in:
Tobias Kündig 2017-01-05 15:57:15 +01:00 committed by Andy
parent 7f88646e17
commit fc5b949e78
4 changed files with 51 additions and 0 deletions

View 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
View 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
View 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
View File

@ -0,0 +1 @@
{ "extends": "../tslint.json" }