hermes: Promise.allSettled and Promise.any is undefined
That super weird that a fresh method from ES2022 Object.hasOwn was implemented, but methods of perv. ecmascript spec not implemented yet:
Promise.allSettled(...) // ES2020Promise.any(...) // ES2021
Bug Description
- I have run
gradle cleanand confirmed this bug does not occur with JSC
Hermes version: 0.11.0 React Native version (if any): 0.69.0 OS version (if any): Android 11 Platform: arm64-v8a, armeabi-v7a, x86, x86_64
Steps To Reproduce
const object1 = {prop: 'exists'};
console.log(Object.hasOwn(object1, 'prop')); // true
console.log(Object.hasOwn(object1, 'toString')); // false
Promise.allSettled([]); // TypeError: undefined is not a function, js engine: hermes
Promise.any([]); // TypeError: undefined is not a function, js engine: hermes
The Expected Behavior
// `Promise.allSettled, Promise.any` works without any exceptions
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18 (11 by maintainers)
Commits related to this issue
- Add support `Promise.any` out of box (#35080) Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: https://github.com/facebook/hermes/issu... — committed to facebook/metro by retyui 2 years ago
- Add support `Promise.any` out of box (#35080) Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: https://github.com/facebook/hermes/issu... — committed to facebook/react-native by retyui 2 years ago
- Add support `Promise.any` out of box (#35080) Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: https://github.com/facebook/hermes/issu... — committed to facebook/react-native by retyui 2 years ago
- Add support `Promise.any` out of box (#35080) Summary: `promise` module diff: [`8.2.0...8.3.0`](https://npmfs.com/compare/promise/8.2.0/8.3.0/) - Hermes issue: https://github.com/facebook/hermes/issu... — committed to OlimpiaZurek/react-native by retyui 2 years ago
@leeyyl As I explained, Promise.allSettled has been available in Hermes since September 2022. Download any version of Hermes, compile and run the CLI and see for yourself.
Which version of Hermes is packaged with each RN release is an orthogonal question. You might be using a version of RN without it, or there might be a polyfill that is overwriting Promise, or something else could be wrong in your setup.
We are unable to investigate problems that are outside of Hermes, so consider filing an issue with React Native. They might know what is going on, might be able to pick this change in one of their point releases, etc.
Promise.allSettled- added (0.68.4, v0.69.6, 0.70.x+)https://github.com/facebook/react-native/pull/34544Promise.any- I hope will be added soon https://github.com/facebook/react-native/pull/35080@retyui and those 25 lines are incorrect, per spec. They also break if
delete Promise.allhas been ran, which is also incorrect.This thread isn’t the place to debate it, though.
got it, should be fixed in react-native@0.71.x