const {resolve} = Promise; // fails
Andrea Giammarchi
andrea.giammarchi at gmail.com
Thu Jul 19 11:56:34 UTC 2018
As quickly discussed on Twitter, it's very inconvenient and inconsistent
that the following fails:
```js
const {resolve, reject} = Promise;
resolve(123); // throws
```
Compared to every other public static method in ECMAScript that works,
including those methods that might need the contextual class, as it is for
the Array.from case.
```js
const {from} = Array;
from({0: 'abc', length: 1}); // ["abc"] // all good
```
Why cannot Promise methods fallback to Promise constructor when the
class/context is not available?
Wouldn't be simple/reasonable change to make so that developers
expectations would be preserved?
Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180719/ea6d9784/attachment.html>
More information about the es-discuss
mailing list