UNPKG

2.91 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/once`
3
4# Summary
5This package contains type definitions for once (https://github.com/isaacs/once).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/once.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/once/index.d.ts)
10````ts
11export = once;
12
13declare const once: Once;
14
15interface Once extends once.OnceFn {
16 proto(): void;
17 strict: once.OnceFn;
18}
19
20declare namespace once {
21 interface OnceFn {
22 <R>(f: () => R): (() => R) & FnProps<R>;
23 <T1, R>(f: (t1: T1) => R): ((t1: T1) => R) & FnProps<R>;
24 <T1, T2, R>(f: (t1: T1, t2: T2) => R): ((t1: T1, t2: T2) => R) & FnProps<R>;
25 <T1, T2, T3, R>(f: (t1: T1, t2: T2, t3: T3) => R): ((t1: T1, t2: T2, t3: T3) => R) & FnProps<R>;
26 <T1, T2, T3, T4, R>(
27 f: (t1: T1, t2: T2, t3: T3, t4: T4) => R,
28 ): ((t1: T1, t2: T2, t3: T3, t4: T4) => R) & FnProps<R>;
29 <T1, T2, T3, T4, T5, R>(
30 f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R,
31 ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R) & FnProps<R>;
32 <T1, T2, T3, T4, T5, T6, R>(
33 f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R,
34 ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R) & FnProps<R>;
35 <T1, T2, T3, T4, T5, T6, T7, R>(
36 f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7) => R,
37 ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7) => R) & FnProps<R>;
38 <T1, T2, T3, T4, T5, T6, T7, T8, R>(
39 f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) => R,
40 ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) => R) & FnProps<R>;
41 <T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(
42 f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9) => R,
43 ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9) => R) & FnProps<R>;
44 <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(
45 f: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10) => R,
46 ): ((t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10) => R) & FnProps<R>;
47 <R>(f: (...args: any[]) => R): ((...args: any[]) => R) & FnProps<R>;
48 }
49
50 interface FnProps<R> {
51 called: boolean;
52 value: R | undefined;
53 }
54}
55
56declare global {
57 interface Function {
58 // eslint-disable-next-line @typescript-eslint/ban-types
59 once(): Function & once.FnProps<any>;
60 }
61}
62
63````
64
65### Additional Details
66 * Last updated: Mon, 20 Nov 2023 23:36:24 GMT
67 * Dependencies: none
68
69# Credits
70These definitions were written by [Denis Sokolov](https://github.com/denis-sokolov), and [BendingBender](https://github.com/BendingBender).
71
\No newline at end of file