facebook / facebook/hermes

Iterator helpers missing

Open
#1,684 3 comments 3 reactions 1 assignee Claimed by @tmikov View on GitHub
enhancement
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

## Bug Description

[Iterator Helpers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods) have been added to WebKit / JSC [recently](https://github.com/WebKit/WebKit/pull/34418). They are [available in Safari >= 18.4](https://webkit.org/blog/16574/webkit-features-in-safari-18-4/#javascript). Hermes does not support them yet.

I ran into this by accident because TypeScript's ECMA support already suggests helper methods on iterators.

- [x] I have run `gradle clean` and confirmed this bug does not occur with JSC
- [x] The issue is reproducible with the latest version of React Native.

Hermes git revision (if applicable): rn/0.79-stable
React Native version: 0.79
OS: macOS 14.7.2
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): arm64

## Steps To Reproduce

One-liner:
```js
new Map([["a", 1], ["b", 2]]).values().map(v => v * 2)
// Uncaught TypeError: new Map([["a", 1], ["b", 2]]).values().map is not a function (it is undefined)
```

## The Expected Behavior

Should not throw and instead return a new iterator. The code above works in Safari 18.4 console.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.