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(...) // ES2020
  • Promise.any(...) // ES2021

Bug Description

  • I have run gradle clean and 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

Most upvoted comments

@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.

@retyui and those 25 lines are incorrect, per spec. They also break if delete Promise.all has 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