Skip to content

Object rest does not preserve enumerable Symbol keys #12252

Closed
@Jessidhia

Description

@Jessidhia

Checked with the improved __rest helper from this PR, but also applies to master.

The CopyDataProperties operation that is used to define object rest uses the [[OwnPropertyKeys]] operation, which does return Symbols (https://tc39.github.io/ecma262/#sec-ordinaryownpropertykeys).

for .. in, however, skips over Symbol keys; a potential fix it so do a second copy loop with the result of Object.getOwnPropertySymbols if available.

Screenshot of a Chrome REPL session comparing __rest's behavior with Object.assign, which is supposed to have (almost) the same copying behavior:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions