Type alias Awaitable<T>

Awaitable<T>: (() => Promise<T> | T)

Represents a function that returns a promise or a value.

Type Parameters

  • T

    The type of the value returned by the function.

Type declaration

    • (): Promise<T> | T
    • Returns Promise<T> | T

Returns

A promise or a value of type T.

Example

const myFunction: Awaitable<number> = async () => {
const result = await someAsyncOperation();
return result + 1;
};

Generated using TypeDoc