Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"Returns a Promise" check is incorrect #20

Closed
joepie91 opened this issue Sep 26, 2019 · 1 comment
Closed

"Returns a Promise" check is incorrect #20

joepie91 opened this issue Sep 26, 2019 · 1 comment

Comments

@joepie91
Copy link

This library currently checks whether the callback returned a Promise by doing returnVal instanceof Promise, but this is incorrect; it only considers the global ES6 Promise implementation in the library's scope/realm, and not any other Promise implementations (including cross-realm Promises, non-global polyfills, and other Promises/A+ compliant Promise implementations such as Bluebird).

The correct check, as per the Promises/A+ specification, would be more something like:

returnVal != null && typeof returnVal.then === "function"
@andyfleming
Copy link
Owner

Good catch @joepie91. We'll see if we can get this addressed. 👍

andyfleming added a commit that referenced this issue Jan 14, 2020
Modify Promise check, Closes #20
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants