Represents a value that may or may not be wrapped in a Promise.
Promise
Useful for APIs accepting both synchronous values and promises.
The underlying value type.
async function process(input: Promisable<string>): Promise<number> { const value = await input; return value.length;}process("hello"); // Synchronous valueprocess(Promise.resolve("hello")); // Promise Copy
async function process(input: Promisable<string>): Promise<number> { const value = await input; return value.length;}process("hello"); // Synchronous valueprocess(Promise.resolve("hello")); // Promise
Represents a value that may or may not be wrapped in a
Promise.Useful for APIs accepting both synchronous values and promises.