# @types/once

> TypeScript definitions for once

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

## Install

```sh
npm install @types/once
pnpm add @types/once
yarn add @types/once
bun add @types/once
```

## 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 | 1.4.5 |
| Published | 2024-10-23 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51437 |
| Maintainers | types |

## Links

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

## Recent versions

- 1.4.5 (latest) — 2024-10-23
- 1.4.4 (ts4.7) — 2023-11-21
- 1.4.1 (ts4.4) — 2023-09-03
- 1.4.0 (ts2.8) — 2017-08-23
- 1.4.3 — 2023-11-07
- 1.4.2 — 2023-10-18
- 1.3.28 — 2016-09-19
- 1.3.27 — 2016-07-14
- 1.3.26-alpha — 2016-07-08
- 1.3.25-alpha — 2016-07-04
- 1.3.24-alpha — 2016-07-02
- 1.3.23-alpha — 2016-07-01
- 1.3.22-alpha — 2016-07-01
- 1.3.21-alpha — 2016-05-25
- 1.3.20-alpha — 2016-05-20
- … 2 more at https://npm.io/package/@types/once/versions

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/once/index.d.ts)
````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/no-unsafe-function-type
        once(): Function & once.FnProps<any>;
    }
}

````

### Additional Details
 * Last updated: Wed, 23 Oct 2024 03:36:41 GMT
 * Dependencies: none

# Credits
These definitions were written by [Denis Sokolov](https://github.com/denis-sokolov), and [BendingBender](https://github.com/BendingBender).

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