# @types/continuation-local-storage

> TypeScript definitions for continuation-local-storage

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

## Install

```sh
npm install @types/continuation-local-storage
pnpm add @types/continuation-local-storage
yarn add @types/continuation-local-storage
bun add @types/continuation-local-storage
```

## 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 | 3.2.7 |
| Published | 2023-11-07 |
| First published | 2016-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

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

## Dependencies (1)

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

## Recent versions

- 3.2.7 (latest) — 2023-11-07
- 3.2.5 (ts4.3) — 2023-09-04
- 3.2.4 (ts3.8) — 2021-12-23
- 3.2.3 (ts3.5) — 2021-03-07
- 3.2.2 (ts2.1) — 2019-08-14
- 3.2.0 (ts2.0) — 2016-12-01
- 3.2.6 — 2023-10-18
- 3.2.1 — 2017-04-17

## README

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

export type Context = {
    [key: string]: any;
};

export type BindCallbackFn<T> = (...args: any[]) => T;
export type RunCallbackFn<T> = (context: Context) => T;

export interface Namespace {
    readonly name: string; // Note: this is readonly because changing it does not actually rename it

    readonly active: Context; // Note: this is readonly because changing it manually will break functionality
    createContext(): Context;

    set<T>(key: string, value: T): T;
    get<T>(key: string): T | undefined;

    run<T = void>(callback: RunCallbackFn<T>): Context;
    runAndReturn<T>(callback: RunCallbackFn<T>): T;

    bind<T = void>(callback: BindCallbackFn<T>, context?: Context): BindCallbackFn<T>;
    bindEmitter(emitter: NodeJS.EventEmitter): void;

    enter(context: Context): void;
    exit(context: Context): void;
}

export function createNamespace(name: string): Namespace;
export function getNamespace(name: string): Namespace | undefined;
export function destroyNamespace(name: string): void;
export function reset(): void;

// declare namespace process {
//     var namespaces: ContinuationLocalStorage.Namespace[];
// }

````

### Additional Details
 * Last updated: Mon, 06 Nov 2023 22:41:05 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Jang-Ho Hwang](https://github.com/rath), [Kei Son](https://github.com/heycalmdown), and [Dmitry Kudryavtsev](https://github.com/skwee357).

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