Promise.isPromise
Static method that checks whether a value is a thenable — that is, any object with a .then method.
| Type | TC39 | CoreJS | Babel | Civet | JS+ |
|---|---|---|---|---|---|
| Polyfill | ✅ Stage 2 View | ❌ | ❌ | ❌ | ✅ via Custom |
Promise.isPromise(arg: any): arg is PromiseLike<any>
Section titled “Promise.isPromise(arg: any): arg is PromiseLike<any>”Returns true if arg is a thenable. Because it follows Promises/A+, it returns true for any object or function with a .then method, not strictly native Promise instances.
The return type is a TypeScript type predicate, so the type of arg is automatically narrowed to PromiseLike<unknown> inside a truthy branch.
Promise.isPromise(Promise.resolve(1)); // → truePromise.isPromise(fetch('/api/data')); // → truePromise.isPromise({ then: () => {} }); // → true (thenable)
Promise.isPromise(null); // → falsePromise.isPromise(undefined); // → falsePromise.isPromise(42); // → falsePromise.isPromise({ then: 'not a fn' }); // → false