Inconsistent naming between .resolve() and .fulfilled()
See original GitHub issueHello,
I noticed an inconsistency between the aliases of the “return a resolved promise, immediately” method: One is named .resolve()
, and the other .fulfilled()
. I would expect .resolve()
to be called .resolved()
(or .fulfilled()
-> .fulfill()
). By contrast, the “return a rejected promise” method exists as both .rejected()
and .reject()
.
I’ve tried to do .resolved()
on more than one occasion, so I thought I’d post this. It isn’t a huge deal, but seeing as this is a beautiful and (otherwise) very consistent library, it might be worth it to create the .fulfill()
and .resolved()
aliases.
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Does "resolve" consistently mean something distinct from ...
No, there is no inconsistency here, the terms in the spec are ... There is a Promise.reject() method, but no Promise.fulfill() method.
Read more >How to Handle the Incompatible Types Error in Java - Rollbar
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >await - JavaScript - MDN Web Docs
The await operator is used to wait for a Promise and get its fulfillment value. ... The expression is resolved in the same...
Read more >FindBugs Bug Descriptions - SourceForge
Eq: Abstract class defines covariant equals() method, Bad practice ... Nm: Class names shouldn't shadow simple name of superclass ...
Read more >Teacher Expectations and Self-Fulfilling Prophecies
Teacher Expectations and Self-Fulfilling Prophecies: Knowns and Unknowns, Resolved and Unresolved Controversies. Lee Jussim and Kent D. HarberView all ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here is the state tree of Promises:
Therefore, fulfil is simply the wrong word. Because the method takes a promise as an argument, and that promise may be rejected with an error (and therefore not fulfilled) resolved is the right word to use - it will either lock-in the promise to another, or settle it with a normal (“Right”) value.
The first version of bluebird used a different terminology, then @domenic made a push to standardise the basic words to be consistent with other libraries, but there are some remaining materials here and there that still use the original method names…
edit: I updated the article to resolve this (no pun intended). Thanks!
@spion Oh of course it’s there: http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects - and I even have cited that section in my SO answer. I just forgot they used the term “locked in” in the standard.