mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 05:01:42 +03:00
27 lines
678 B
TypeScript
27 lines
678 B
TypeScript
|
// @target: esnext, es2022, es2015
|
||
|
// @useDefineForClassFields: false
|
||
|
|
||
|
class A {
|
||
|
static #field = 1;
|
||
|
otherClass = A;
|
||
|
testObject() {
|
||
|
return { x: 10, y: 6 };
|
||
|
}
|
||
|
testArray() {
|
||
|
return [10, 11];
|
||
|
}
|
||
|
constructor() {
|
||
|
let y: number;
|
||
|
({ x: A.#field, y } = this.testObject());
|
||
|
([A.#field, y] = this.testArray());
|
||
|
({ a: A.#field, b: [A.#field] } = { a: 1, b: [2] });
|
||
|
[A.#field, [A.#field]] = [1, [2]];
|
||
|
({ a: A.#field = 1, b: [A.#field = 1] } = { b: [] });
|
||
|
[A.#field = 2] = [];
|
||
|
[this.otherClass.#field = 2] = [];
|
||
|
}
|
||
|
static test(_a: typeof A) {
|
||
|
[_a.#field] = [2];
|
||
|
}
|
||
|
}
|