Do we have any proposal for an isPromise static function on the Promise constructor?
Right now, there are many ways to test for whether an object is just "thenable" or an actual native promise.
Hi,
I don't know of any such proposal, the example codes you've given seem sufficient for all the common use cases.
It would depend on your goal of course. (And tbh I'd dub the second one isThenable, not isPromise). So, for what do you need to check whether a value is a promise?
Agreed. The rare exceptions that do exist lie almost exclusively within frameworks and the like, and they care about if there's a .then method, not if it's a native promise.
Edit: Rip out a bunch of incorrect claims I spent too much time writing.
I am also trying to find out if somebody wants to help implement convenient value checks as described in this article and this proposal. Maybe Promise could be similarly implemented?