Closed
Description
Bug Report
🔎 Search Terms
static ES private fields, static private members, computed class method name, class instantiation fails
🕗 Version & Regression Information
4.3.0-beta
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about static class members
- I was unable to test this on prior versions because static ES private fields weren't added until 4.3
⏯ Playground Link
Playground link with relevant code
💻 Code
class Foo {
static #qux = 42;
["bar"] () {}
}
new Foo;
🙁 Actual behavior
A runtime error ReferenceError: Cannot access 'Foo' before initialization
when using target: "es2021"
when trying to instantiate a class that contains both a static ES #private field and a method that has a computed method name. Compiled code runs fine without runtime errors when using target: "ESNEXT"
(no downleveling).
🙂 Expected behavior
Code runs without errors.