Skip to content

Set polyfill says it is [object Object] but should say [object Set] #19594

Description

@lll000111

Environment

Any - you can reproduce the issue using only file

https://github.com/facebook/react-native/blob/master/Libraries/vendor/core/Set.js

and any Javascript encironment.

EDIT: Just for the bot, it is completely irrelevant:

Environment:
OS: Windows 10
Node: 10.3.0
Yarn: Not Found
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.1.0.0 AI-173.4720617

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

Description and Steps to Reproduce

Here is code that creates a simple Set object and then uses the spread operator to spread the Set's contents into a new array.

First, using an environment where the above file was executed/loaded (plus its own dependencies), and I also short-circuited the detection at the beginning that determines whether the polyfill is applied:

const s1 = new Set([1,2,3]);
console.log(Object.prototype.toString.call(s1));

Result:

[object Object]

Expected Behavior

Now for comparison a clean ES6+ environment without anything loaded, so we get a native Set implementation:

const s1 = new Set([1,2,3]);
console.log(Object.prototype.toString.call(s1));

Result:

[object Set]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions