@jiminp/tooltool
    Preparing search index...

    Type Alias Promisable<T>

    Promisable: T | Promise<T>

    Represents a value that may or may not be wrapped in a Promise.

    Convenient for APIs that accept both synchronous and asynchronous return values, avoiding the need for callers to wrap synchronous results.

    Type Parameters

    • T

      The underlying value type.

    async function process(input: Promisable<string>): Promise<number> {
    const value = await input;
    return value.length;
    }

    process('hello'); // ✓ OK — synchronous
    process(Promise.resolve('hello')); // ✓ OK — asynchronous