Debian Codegraph @

packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/read-only/exec.js

raw
1 class A {
2 counter = 0;
3 #method() {}
4 self() {
5 this.counter++;
6 return this;
7 }
8
9 constructor() {
10 expect(() => this.self().#method = 2).toThrow(TypeError);
11 expect(this.counter).toBe(1);
12 expect(() => ([this.#method] = [2])).toThrow(TypeError);
13 }
14 }
15
16 new A;