function Async Async<X,F extends (_: unknown) => unknown,>(x: X | { then?: (f: F) => Promise<unknown>; },f: F,): unknown Handle T or Promise<T> as Promise<T> Works by checking if the return value of the previous step is thenable. Type Parameters X F extends (_: unknown) => unknown Parameters x: X | { then?: (f: F) => Promise<unknown>; } f: F Return Type unknown
type alias Async Handle T or Promise<T> as Promise<T> Type Parameters T = unknown Definition T | Promise<T>