mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
34 lines
735 B
TypeScript
34 lines
735 B
TypeScript
//// [tests/cases/compiler/destructuringAssignment_private.ts] ////
|
|
|
|
//// [destructuringAssignment_private.ts]
|
|
class C {
|
|
private x = 0;
|
|
private o = [{ a: 1 }];
|
|
}
|
|
let x: number;
|
|
([{ a: { x } }] = [{ a: new C() }]);
|
|
({ o: [{ a: x }]} = new C());
|
|
|
|
const nameX = "x";
|
|
([{ a: { [nameX]: x } }] = [{ a: new C() }]);
|
|
|
|
const nameO = "o";
|
|
({ [nameO]: [{ a: x }]} = new C());
|
|
|
|
|
|
//// [destructuringAssignment_private.js]
|
|
"use strict";
|
|
class C {
|
|
constructor() {
|
|
this.x = 0;
|
|
this.o = [{ a: 1 }];
|
|
}
|
|
}
|
|
let x;
|
|
([{ a: { x } }] = [{ a: new C() }]);
|
|
({ o: [{ a: x }] } = new C());
|
|
const nameX = "x";
|
|
([{ a: { [nameX]: x } }] = [{ a: new C() }]);
|
|
const nameO = "o";
|
|
({ [nameO]: [{ a: x }] } = new C());
|