function isPromise < T > ( object ) { const isObjectOrFunction = ( typeof object === 'object' && object !== null ) || typeof object === 'function' ; return isObjectOrFunction && typeof ( object as PromiseLike < T > ) . then === "function" ; } function isPromiseOrContainsPromise < T > ( object ) { if ( isPromise ( object ) ) { return true ; } return Array . isArray ( object ) && object . some ( isPromise ) ; } export { isPromise , isPromiseOrContainsPromise } ;