Page Contents

Home > @loopback/context > AsValueOrPromise

AsValueOrPromise type

Create the Promise type for T. If T extends Promise, the type is T, otherwise the type is ValueOrPromise<T>.

Signature:

export type AsValueOrPromise<T> = T extends Promise<unknown> ? T : ValueOrPromise<T>;

References: ValueOrPromise