# closeout/onetime

> Every export of closeout/onetime, with its signature and doc comment: onetime, plus 2 types.

Source: https://closeout.interlace.tools/docs/api/onetime

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

`closeout/onetime` — the drop-in path for `onetime` 8 (`graded-override-targets` R3).

```ts
import onetime from 'closeout/onetime';
import type { Options, OnetimeFunction } from 'closeout/onetime';
```

## Constants

### default

The default export, declared as `onetime`.

Ensure a function is called once; later calls return the first result.

```ts
const onetime: typeof onceUntilReturned & {
    callCount: typeof callCount;
};
```

## Interfaces

### Options

Options onetime takes.

```ts
interface Options {
    /** Throw when called more than once, instead of returning the first result. */
    readonly throw?: boolean;
}
```

## Types

### OnetimeFunction

A function wrapped by onetime: the same signature, called through the wrapper.

```ts
type OnetimeFunction<ArgumentsType extends unknown[], ReturnType> = (...arguments_: ArgumentsType) => ReturnType;
```
