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 061c93c4d6..08acc62e42 100644 --- a/clone/clone.d.ts +++ b/clone/clone.d.ts @@ -8,10 +8,18 @@ */ declare module "clone" { /** - * @param parent - * @param circular If not given, defaults to true in JS lib. + * @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(parent: Object, circular?: boolean): Object + function clone(val: T, circular?: boolean, depth?: number): T; + + module clone { + /** + * @param obj the object that you want to clone + */ + function clonePrototype(obj: T): T; + } export = clone }