Skip to content

[Bug]: in operator with non-object in private static fields #15013

@p51lee

Description

@p51lee

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

class C { static #x = #x in 0 } ;

Configuration file name

No response

Configuration

No response

Current and expected behavior

The input program is expected to throw TypeError but the transpiled program terminates without any error.

node
Welcome to Node.js v18.10.0.
Type ".help" for more information.
> class C { static #x = #x in 0 } ;
Uncaught TypeError: Cannot use 'in' operator to search for '#x' in 0
    at <static_initializer> (REPL1:1:26)

Environment

Reproductions on Babel's own REPL

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions