# @types/clone

> TypeScript definitions for clone

Latest version **2.1.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/clone
pnpm add @types/clone
yarn add @types/clone
bun add @types/clone
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.4 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51439 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/clone
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/clone
- npm.io page: https://npm.io/package/@types/clone

## Recent versions

- 2.1.4 (latest) — 2023-11-07
- 2.1.2 (ts4.3) — 2023-09-04
- 2.1.1 (ts3.6) — 2021-07-06
- 2.1.0 (ts3.0) — 2020-08-08
- 0.1.30 (ts2.0) — 2016-09-19
- 2.1.3 — 2023-10-17
- 0.1.29 — 2016-07-14
- 0.1.28-alpha — 2016-07-08
- 0.1.27-alpha — 2016-07-04
- 0.1.26-alpha — 2016-07-02
- 0.1.25-alpha — 2016-07-01
- 0.1.24-alpha — 2016-07-01
- 0.1.23-alpha — 2016-05-25
- 0.1.22-alpha — 2016-05-20
- 0.1.17-alpha — 2016-05-19
- … 1 more at https://npm.io/package/@types/clone/versions

## README

# Installation
> `npm install --save @types/clone`

# Summary
This package contains type definitions for clone (https://github.com/pvorb/node-clone).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/clone.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/clone/index.d.ts)
````ts
/**
 * See clone JS source for API docs
 */

/**
 * @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 which the object is to be cloned (optional, defaults to infinity)
 * @param prototype Sets the prototype to be used when cloning an Object (optional, defaults to __proto__)
 * @param includeNonEnumerable Set to true if the non-enumerable properties should be cloned as well (optional, defaults to false)
 */
declare function clone<T>(
    val: T,
    circular?: boolean,
    depth?: number,
    prototype?: any,
    includeNonEnumerable?: boolean,
): T;

/**
 * @param val the value that you want to clone, any type allowed
 * @param opts a single object that specifies circular, depth, prototype and includeNonEnumerable.
 * @param opts.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 opts.depth Sets depth to which the object is to be cloned (optional, defaults to infinity)
 * @param opts.prototype Sets the prototype to be used when cloning an Object (optional, defaults to __proto__)
 * @param opts.includeNonEnumerable Set to true if the non-enumerable properties should be cloned as well (optional, defaults to false)
 */
declare function clone<T>(val: T, opts: CloneOpts): T;

interface CloneOpts {
    circular?: boolean | undefined;
    depth?: number | undefined;
    prototype?: any;
    includeNonEnumerable?: boolean | undefined;
}

declare namespace clone {
    /**
     * @param obj the object that you want to clone
     */
    function clonePrototype<T>(obj: T): T;
}

export = clone;

````

### Additional Details
 * Last updated: Mon, 06 Nov 2023 22:41:05 GMT
 * Dependencies: none

# Credits
These definitions were written by [Kieran Simpson](https://github.com/kierans), and [DG-za](https://github.com/DG-za).

---
_Source: https://npm.io/package/@types/clone · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
