mirror of
https://github.com/swc-project/swc.git
synced 2024-12-28 08:04:43 +03:00
39 lines
755 B
TypeScript
39 lines
755 B
TypeScript
// @target: esnext, es2022, es2015
|
|
|
|
class A {
|
|
#a = 'a';
|
|
#b: string;
|
|
|
|
readonly #c = 'c';
|
|
readonly #d: string;
|
|
|
|
#e = '';
|
|
|
|
constructor() {
|
|
this.#b = 'b';
|
|
this.#d = 'd';
|
|
}
|
|
|
|
test() {
|
|
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
|
const {
|
|
[this.#a]: a,
|
|
[this.#b]: b,
|
|
[this.#c]: c,
|
|
[this.#d]: d,
|
|
[this.#e = 'e']: e,
|
|
} = data;
|
|
console.log(a, b, c, d, e);
|
|
|
|
const a1 = data[this.#a];
|
|
const b1 = data[this.#b];
|
|
const c1 = data[this.#c];
|
|
const d1 = data[this.#d];
|
|
const e1 = data[this.#e];
|
|
console.log(a1, b1, c1, d1);
|
|
}
|
|
}
|
|
|
|
new A().test();
|
|
|