diff --git a/deep-assign/deep-assign-tests.ts b/deep-assign/deep-assign-tests.ts new file mode 100644 index 0000000000..f38a1fc378 --- /dev/null +++ b/deep-assign/deep-assign-tests.ts @@ -0,0 +1,10 @@ +import * as deepAssign from 'deep-assign'; + +deepAssign({a: 1}); +deepAssign({a: 1}, {b: 2}); +deepAssign({a: 1, b: {c: 2}}, {b: {e: 33}, x: 11}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}, {e: 5}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}, {e: 5}, {f: 6}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}, {e: 5}, {f: 6}, {g: 7}); diff --git a/deep-assign/index.d.ts b/deep-assign/index.d.ts new file mode 100644 index 0000000000..46d4cf09f2 --- /dev/null +++ b/deep-assign/index.d.ts @@ -0,0 +1,77 @@ +// Type definitions for clone 0.1.11 +// Project: https://github.com/sindresorhus/deep-assign +// Definitions by: Ionut Costica +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Pretty much just returns the target object + * @param target Base object + */ +declare function deepAssign(target: T): T; +/** + * Deeply assigns all the properties of the source object to the + * target object + * @param target Base object + * @param source Extending object + */ +declare function deepAssign(target: T, source: U): T & U; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + */ +declare function deepAssign(target: T, source1: U, source2: V): T & U & V; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + * @param source4 Fourth extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + * @param source4 Fourth extending object + * @param source5 Fifth extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W, source4: X, source5: Y): T & U & V & W & X & Y; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + * @param source4 Fourth extending object + * @param source5 Fifth extending object + * @param source6 Sixth extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W, source4: X, source5: Y, source6: Z): T & U & V & W & X & Y & Z; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param sources Extending objects + */ +declare function deepAssign(target: any, ...sources: any[]): any; + +declare namespace deepAssign {} +export = deepAssign; diff --git a/deep-assign/tsconfig.json b/deep-assign/tsconfig.json new file mode 100644 index 0000000000..5f80a3df8f --- /dev/null +++ b/deep-assign/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "deep-assign-tests.ts" + ] +}