Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid code generated when static properties are used in combination with decorators #3823

Open
jrieken opened this issue Jul 2, 2024 · 0 comments

Comments

@jrieken
Copy link

jrieken commented Jul 2, 2024

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);

// file2.ts
var Foo = class extends Disposable {
  constructor(_themeService) {
    super();
    this._themeService = _themeService;
    this.width = Foo.B;
  }
  static {
    this.A = 15;
  }
  static {
    this.B = Foo.A * 2;
//     ^^^^^^^^^^
// Foo doesn't exist
  }
};
Foo = __decorateClass([
  __decorateParam(0, IThemeService)
], Foo);

// entry.js
new Foo();
jrieken added a commit to microsoft/vscode that referenced this issue Jul 2, 2024
@jrieken jrieken changed the title Invalid code generated, fails to load because variable is used during its declaration Invalid code generated when static properties are used in combination with decorators Jul 5, 2024
jrieken added a commit to microsoft/vscode that referenced this issue Jul 5, 2024
jrieken added a commit to microsoft/vscode that referenced this issue Jul 5, 2024
* chore - push workaround and a lint rule for evanw/esbuild#3823

* modernize `tsconfig.monaco`
aaronchucarroll pushed a commit to aaronchucarroll/vscode that referenced this issue Jul 10, 2024
…soft#220077)

* chore - push workaround and a lint rule for evanw/esbuild#3823

* modernize `tsconfig.monaco`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant