diff --git a/deepmerge/deepmerge-tests.ts b/deepmerge/deepmerge-tests.ts new file mode 100644 index 0000000000..7854f7adf1 --- /dev/null +++ b/deepmerge/deepmerge-tests.ts @@ -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(x, y); \ No newline at end of file diff --git a/deepmerge/index.d.ts b/deepmerge/index.d.ts new file mode 100644 index 0000000000..bf70f62e46 --- /dev/null +++ b/deepmerge/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for deepmerge 1.3 +// Project: https://github.com/KyleAMathews/deepmerge +// Definitions by: marvinscharle +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = deepmerge; + +declare function deepmerge(x: T, y: T, options?: deepmerge.Options): T; + +declare namespace deepmerge { + interface Options { + clone?: boolean; + arrayMerge?: (destination: T, source: T, options?: Options) => T; + } + + function all(objects: T[], options?: Options): T; +} \ No newline at end of file diff --git a/deepmerge/tsconfig.json b/deepmerge/tsconfig.json new file mode 100644 index 0000000000..750aeec703 --- /dev/null +++ b/deepmerge/tsconfig.json @@ -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" + ] +} diff --git a/deepmerge/tslint.json b/deepmerge/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/deepmerge/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }