# @types/cls-hooked

> TypeScript definitions for cls-hooked

Latest version **4.3.9** (published 2024-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/cls-hooked
pnpm add @types/cls-hooked
yarn add @types/cls-hooked
bun add @types/cls-hooked
```

## Health

**Score 55/100 (C)** — status: stable.

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

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 4.3.9 |
| Published | 2024-10-23 |
| First published | 2017-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51447 |
| Maintainers | types |

## Links

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

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 4.3.9 (latest) — 2024-10-23
- 4.3.8 (ts4.5) — 2023-11-07
- 4.3.6 (ts4.3) — 2023-09-04
- 4.3.3 (ts3.4) — 2021-02-05
- 4.3.1 (ts3.2) — 2020-07-31
- 4.3.0 (ts2.7) — 2019-03-09
- 4.3.7 — 2023-10-17
- 4.3.5 — 2023-08-22
- 4.3.4 — 2023-06-14
- 4.3.2 — 2021-02-04
- 4.2.1 — 2018-06-27
- 4.2.0 — 2017-10-03

## README

# Installation
> `npm install --save @types/cls-hooked`

# Summary
This package contains type definitions for cls-hooked (https://github.com/jeff-lewis/cls-hooked).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cls-hooked.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cls-hooked/index.d.ts)
````ts
/// <reference types="node" />

import { EventEmitter } from "events";

export interface Namespace<N = Record<string, any>> {
    active: any;

    set<K extends keyof N = keyof N>(key: K, value: N[K]): N[K];
    get<K extends keyof N = keyof N>(key: K): N[K];
    run(fn: (...args: any[]) => void): void;
    runAndReturn<T>(fn: (...args: any[]) => T): T;
    runPromise<T>(fn: (...args: any[]) => Promise<T>): Promise<T>;
    bind<F extends Function>(fn: F, context?: any): F; // eslint-disable-line @typescript-eslint/no-unsafe-function-type
    bindEmitter(emitter: EventEmitter): void;
    createContext(): any;
    enter(context: any): void;
    exit(context: any): void;
}

// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
export function createNamespace<N = Record<string, any>>(name: string): Namespace<N>;
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
export function getNamespace<N = Record<string, any>>(name: string): Namespace<N> | undefined;
export function destroyNamespace(name: string): void;
export function reset(): void;

````

### Additional Details
 * Last updated: Wed, 23 Oct 2024 03:36:41 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Leo Liang](https://github.com/aleung), and [Lucian Buzzo](https://github.com/LucianBuzzo).

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