@types/once
TypeScript icon, indicating that this package has built-in type declarations

1.4.4 • Public • Published

Installation

npm install --save @types/once

Summary

This package contains type definitions for once (https://github.com/isaacs/once).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/once.

index.d.ts

export = once;

declare const once: Once;

interface Once extends once.OnceFn {
    proto(): void;
    strict: once.OnceFn;
}

declare namespace once {
    interface OnceFn {
        <R>(f: () => R): (() => R) & FnProps<R>;
        <T1, R>(f: (t1: T1) => R): ((t1: T1) => R) & FnProps<R>;
        <T1, T2, R>(f: (t1: T1, t2: T2) => R): ((t1: T1, t2: T2) => R) & FnProps<R>;
        <T1, T2, T3, R>(f: (t1: T1, t2: T2, t3: T3) => R): ((t1: T1, t2: T2, t3: T3) => R) & FnProps<R>;
        <T1, T2, T3, T4, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4) => R) & FnProps<R>;
        <T1, T2, T3, T4, T5, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R) & FnProps<R>;
        <T1, T2, T3, T4, T5, T6, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R) & FnProps<R>;
        <T1, T2, T3, T4, T5, T6, T7, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7) => R) & FnProps<R>;
        <T1, T2, T3, T4, T5, T6, T7, T8, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) => R) & FnProps<R>;
        <T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9) => R) & FnProps<R>;
        <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(
            f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10) => R,
        ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10) => R) & FnProps<R>;
        <R>(f: (...args: any[]) => R): ((...args: any[]) => R) & FnProps<R>;
    }

    interface FnProps<R> {
        called: boolean;
        value: R | undefined;
    }
}

declare global {
    interface Function {
        // eslint-disable-next-line @typescript-eslint/ban-types
        once(): Function & once.FnProps<any>;
    }
}

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: none

Credits

These definitions were written by Denis Sokolov, and BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/once

Weekly Downloads

58,296

Version

1.4.4

License

MIT

Unpacked Size

7.27 kB

Total Files

5

Last publish

Collaborators

  • types