@luolapeikko/ts-common
    Preparing search index...

    Type Alias Loadable<T>

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

    A type that can be loaded directly, Promise or a function that returns the value or a Promise.

    Type Parameters

    • T

      The type of the value that can be loaded (T can't be a function).

    v0.0.1

    // example resolving a Loadable string
    async function demo(loadable: Loadable<string>) {
    const value1: string = await (typeof loadable === 'function' ? loadable() : loadable);
    const value2: string = await resolveLoadable(loadable);
    }