Type alias MaybePromise<Value>

MaybePromise<Value>: Promise<Value> | Value

A value that might be coming from a Promise.

Example

type MaybeStringPromise = MaybePromise<string>;
const promisedValue: MaybeStringPromise = Promise.resolve("🟢");
const plainValue: MaybeStringPromise = "🟩";

Promise.all([promisedValue, plainValue]).then(console.log); // ["🟢", "🟩"]

Type Parameters

  • Value