-
-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Consider deprecating FulfilledPromise and RejectedPromise (mark as internal only) #155
Comments
@clue I was kinda expecting this to be a PR I could instantly approve ❤️ |
Those 2 classes have been implicitely made part of the public API with the 2.0 release by adding it to the documenttation (see #12). It makes perfect sense to revert that, so 👍 from me. |
Would you introduce a deprecated message? I'm not really sure how to do it. Maybe looking for the caller? |
Closing this as both PR's have been merged. |
@clue deprecation logs with flag |
What purpose does the
FulfilledPromise
andRejectedPromise
have? It's my understanding these should be used internally only and using theresolve()
andreject()
functions is the preferred alternative (or in many cases simply omit it).For instance, here's some example code that highlights how using these classes is often unneeded:
The following code solves the exact same use case without any explicit references to these classes:
Likewise, the following lines also have the same effect:
Do we have valid use cases where it makes sense to expose these classes? I'd love to see some input on this.
If we can't come up with valid use cases, I would suggest deprecating both classes for v2.x and removing them in v3.0 from our public API (which might mean marking them as
@internal
only). This way, we can reduce our API surface and are more in line with other promise implementations (e.g. ES6 promises). This simplifies our documentation and helps steering people to recommended usage patterns.What do you think?
The text was updated successfully, but these errors were encountered: