Class binding references in static field initializers should be resolved to the decorated class
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Input ([playground](https://esbuild.github.io/try/?utm_source=changelog-news#dAAwLjIxLjQAeyB0YXJnZXQ6ICJlczIwMjIiIH0AY2xhc3MgRCB7fTsKQCgoKSA9PiBEKQpjbGFzcyBDIHsKICBzdGF0aWMgcCA9IEMKfQpjb25zb2xlLmxvZyhDLmsgPT09IEQp)):
```js
class D {}
@(() => D)
class C {
static p = C
}
console.log(C.p === D)
```
Option:
```js
{ target: "es2022" }
```
Expected: It should print `true`, as per [spec](https://arai-a.github.io/ecma262-compare/?pr=2417), static field initializers (step 40) should run after the class binding was initialized (step 38).
Actual: It prints `false`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked playground reproduction using target es2022 and confirm that it prints false instead of true. Trace how esbuild handles the decorator and static field initializer in this example, then add regression coverage for the input so the class binding is preserved and the example prints true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100