@xylabs/promise
Version:
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
12 lines (9 loc) • 615 B
text/typescript
import type { PromiseEx } from './PromiseEx.ts'
export type Promisable<T, V = never> = PromiseEx<T, V> | Promise<T> | T
export type PromisableArray<T, V = never> = Promisable<T[], V>
export type OptionalPromisable<T, V = never> = Promisable<T | undefined, V>
export type OptionalPromisableArray<T, V = never> = PromisableArray<T | undefined, V>
export type NullablePromisable<T, V = never> = Promisable<T | null, V>
export type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>
/** @description Used to document promises that are being used as Mutexes */
export type AsyncMutex<T> = Promise<T>