/** Returns true if `maybePromise` is a Promise. */ export const isPromise = < T > ( maybePromise ) : maybePromise is Promise < T > => Boolean ( typeof ( maybePromise as any ) ?. then === 'function' ) ; export const ensurePromise = < T > ( maybePromise ) => isPromise ( maybePromise ) ? maybePromise : Promise . resolve ( maybePromise ) ;