JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1102773
  • Score
    100M100P100Q202504F
  • License MIT

TypeScript definitions for cls-hooked

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/cls-hooked) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    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

    /// <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

    Credits

    These definitions were written by Leo Liang, and Lucian Buzzo.