From 2c58fe95f6c13f6054bcea838e9e57fd70da1d55 Mon Sep 17 00:00:00 2001 From: progre Date: Sun, 16 Nov 2014 22:35:07 +0900 Subject: [PATCH 1/2] fix definition --- clone/clone.d.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/clone/clone.d.ts b/clone/clone.d.ts index 061c93c4d6..cf11069e06 100644 --- a/clone/clone.d.ts +++ b/clone/clone.d.ts @@ -7,11 +7,18 @@ * See clone JS source for API docs */ declare module "clone" { - /** - * @param parent - * @param circular If not given, defaults to true in JS lib. - */ - function clone(parent: Object, circular?: boolean): Object + var clone: { + /** + * @param val the value that you want to clone, any type allowed + * @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj. + * @param depth to wich the object is to be cloned (optional, defaults to infinity) + */ + (val: T, circular?: boolean, depth?: number): T; + /** + * @param obj the object that you want to clone + */ + clonePrototype(obj: T): T; + }; export = clone } From 22290a65aa51d3928cdba3d4624d0b7be0abbe7a Mon Sep 17 00:00:00 2001 From: progre Date: Tue, 18 Nov 2014 20:34:21 +0900 Subject: [PATCH 2/2] fix: better definition --- clone/clone-tests.ts | 3 ++- clone/clone.d.ts | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/clone/clone-tests.ts b/clone/clone-tests.ts index 12a8535349..6a25fb7c30 100644 --- a/clone/clone-tests.ts +++ b/clone/clone-tests.ts @@ -6,4 +6,5 @@ var original = { var copy = clone(original); copy = clone(original, false); -copy = clone(original, true); +copy = clone(original, true, 1); +copy = clone.clonePrototype(original); diff --git a/clone/clone.d.ts b/clone/clone.d.ts index cf11069e06..08acc62e42 100644 --- a/clone/clone.d.ts +++ b/clone/clone.d.ts @@ -7,18 +7,19 @@ * See clone JS source for API docs */ declare module "clone" { - var clone: { - /** - * @param val the value that you want to clone, any type allowed - * @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj. - * @param depth to wich the object is to be cloned (optional, defaults to infinity) - */ - (val: T, circular?: boolean, depth?: number): T; + /** + * @param val the value that you want to clone, any type allowed + * @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj. + * @param depth to wich the object is to be cloned (optional, defaults to infinity) + */ + function clone(val: T, circular?: boolean, depth?: number): T; + + module clone { /** * @param obj the object that you want to clone */ - clonePrototype(obj: T): T; - }; + function clonePrototype(obj: T): T; + } export = clone }