import type { λ } from "./types"; /** * Returns a version of the function `fun` that can only be invoked `limit` * times. * An optional `except` function will be called with the same parameters on any * additional invocations. * * If `fun` returns anything but `void` (or `Promise`), supplying an * `except` function is mandatory. * * The `except` function must have the same return type as `fun`, or — if `fun` * returns a promise — it may return the type that the promise resolves to * synchronously. * * The `except` function may also throw instead of returning a value. */ export declare const limitInvocations: >(fun: T, limit: number, ...[except]: ExcS) => T; /** * Special case of {@link limitInvocations}. `fun` can only be invoked once. * * @see {@link limitInvocations} */ export declare const once: >(fun: T, ...[except]: ExcS) => T; declare type ExcS = ReturnType extends void | PromiseLike ? [except?: Exc] : [except: Exc]; declare type Exc = λ, OptProm>>; declare type OptProm = T extends Promise ? I | Promise : T; export {};