Title: Invalid output for static private fields · Issue #1131 · evanw/esbuild · GitHub
Open Graph Title: Invalid output for static private fields · Issue #1131 · evanw/esbuild
X Title: Invalid output for static private fields · Issue #1131 · evanw/esbuild
Description: It appears references to already-initialized private static members can get lifted out of the lexical scope where their names exist. Input export class Foo { static #bar = 1; static baz = Foo.#bar; } version 0.11.6 minify false format es...
Open Graph Description: It appears references to already-initialized private static members can get lifted out of the lexical scope where their names exist. Input export class Foo { static #bar = 1; static baz = Foo.#bar;...
X Description: It appears references to already-initialized private static members can get lifted out of the lexical scope where their names exist. Input export class Foo { static #bar = 1; static baz = Foo.#bar;...
Opengraph URL: https://github.com/evanw/esbuild/issues/1131
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invalid output for static private fields","articleBody":"It appears references to already-initialized private static members can get lifted out of the lexical scope where their names exist.\r\n\r\n\u003cdetails open>\r\n\u003csummary>Input\u003c/summary>\r\n\r\n```js\r\nexport class Foo {\r\n static #bar = 1;\r\n\r\n static baz = Foo.#bar;\r\n}\r\n```\r\n\r\n\u003cdl>\r\n \u003cdt>version\u003c/dt>\r\n \u003cdd>0.11.6\u003c/dd>\r\n \u003cdt>minify\u003c/dt>\r\n \u003cdd>false\u003c/dd>\r\n \u003cdt>format\u003c/dt>\r\n \u003cdd>esm\u003c/dd>\r\n \u003cdt>target\u003c/dt>\r\n \u003cdd>none / esnext / maybe others do it too\u003c/dd>\r\n\u003c/dl>\r\n\r\n\u003c/details>\r\n\r\n\u003cdetails open>\r\n\u003csummary>Output\u003c/summary>\r\n\r\n```js\r\nvar __defProp = Object.defineProperty;\r\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;\r\nvar __publicField = (obj, key, value) => {\r\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\r\n return value;\r\n};\r\n\r\nvar _Foo = class {\r\n static #bar;\r\n};\r\nvar Foo = _Foo;\r\nFoo.#bar = 1;\r\n__publicField(Foo, \"baz\", _Foo.#bar);\r\nexport {\r\n Foo\r\n};\r\n```\r\n\r\n\u003c/details>\r\n\r\nThe condition for this seems to be the presence of a reference to `Foo` (or `this`) in a static initializer (which may or may not be private). I think it’s the same set of scenarios where it’s altering the value of `Foo.name`.","author":{"url":"https://github.com/bathos","@type":"Person","name":"bathos"},"datePublished":"2021-04-09T15:20:42Z","url":"https://github.com/evanw/esbuild/issues/1131"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b873d3e0-0075-afe1-631b-8a6a9b72c8e1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE42:66C72:72A4:A958:6AEDA3AC |
| html-safe-nonce | 9e10bf571b0a27b5d4a05fc2711d483c98b9ef98b7ee05a2343d177b6457c20b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTQyOjY2QzcyOjcyQTQ6QTk1ODo2QUVEQTNBQyIsInZpc2l0b3JfaWQiOiI0NTgyNTM5NzQ1MDg1NDY1NTE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e049e5b6db4ee06bb5e9422f45b31d2e2619460e1b1f0717b738add05399ad82 |
| hovercard-subject-tag | issue:854621859 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/evanw/esbuild/1131/issue_layout |
| twitter:image | https://opengraph.githubassets.com/664e926d05be1701d1f1d89abc6fd8dcd979fa9aca98dbcba2cd4834ac24b2ed/evanw/esbuild/issues/1131 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/664e926d05be1701d1f1d89abc6fd8dcd979fa9aca98dbcba2cd4834ac24b2ed/evanw/esbuild/issues/1131 |
| og:image:alt | It appears references to already-initialized private static members can get lifted out of the lexical scope where their names exist. Input export class Foo { static #bar = 1; static baz = Foo.#bar;... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bathos |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9f51e3b6c7a190e426e641ae15acbc58dd1ac2003e96b58879bbc298e213dbf3 |
| turbo-cache-control | no-preview |
| go-import | github.com/evanw/esbuild git https://github.com/evanw/esbuild.git |
| octolytics-dimension-user_id | 406394 |
| octolytics-dimension-user_login | evanw |
| octolytics-dimension-repository_id | 61137153 |
| octolytics-dimension-repository_nwo | evanw/esbuild |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 61137153 |
| octolytics-dimension-repository_network_root_nwo | evanw/esbuild |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7060660810b587033ea861b8aa67beb72c8e6542 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width