-
Notifications
You must be signed in to change notification settings - Fork 1.3k
bug: error declaring a class with static private method as expression #1498
Copy link
Copy link
Closed
Description
Description
When declaring a class with a static private method as an expression, it throws a type error at run time.
Reproduction
$ echo '(class { static #x() {} })' | npx esbuild --target=es2015 | node
[stdin]:2
if (member.has(obj))
^
TypeError: Cannot read property 'has' of undefined
at __privateAdd ([stdin]:2:14)
at [stdin]:7:1
at Script.runInThisContext (vm.js:133:18)
at Object.runInThisContext (vm.js:310:38)
at internal/process/execution.js:77:19
at [stdin]-wrapper:6:22
at evalScript (internal/process/execution.js:76:60)
at internal/main/eval_stdin.js:29:5
at Socket.<anonymous> (internal/process/execution.js:205:5)
at Socket.emit (events.js:327:22)Other info
Seems it was introduced in v0.11.20, as it worked in v0.11.19:
$ echo '(class { static #x() {} })' | npx [email protected] --target=es2015 | nodeCredits to @PrettyWood for finding the bug in privatenumber/esbuild-loader#186
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels