Skip to content

objectWithoutPropertiesLoose helper uses array.includes(), breaking ES5 #17084

@tquetano-netflix

Description

@tquetano-netflix

💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

Link to REPL - Note the use of .includes() in the injected helper.

Configuration file name

No response

Configuration

No response

Current and expected behavior

Current behavior

The objectWithoutProperties and objectWithoutPropertiesLoose helpers leverage array.includes() to check for properties to exclude from the object.

I believe it was part of this change several months back, which changes many .indexOf() statements to .includes() for several checks.

Expected behavior

The helper would use an ES5 compatible comparison for runtime when transform-rest-spread is applied.

Environment

  • Babel version: 7.26.6
  • Node: 22.2.0
  • npm/Yarn version: Yarn 4
  • OS: Ubuntu 24.04
  • Monorepo: yes

Possible solution

I'm more than happy to tweak the code to just use .indexOf() for that helper, but I wanted to surface the issue for discussion before jumping to a solution in case there is a preferred path.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions