mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
27 lines
636 B
TypeScript
27 lines
636 B
TypeScript
//// [tests/cases/compiler/destructureComputedProperty.ts] ////
|
|
|
|
//// [destructureComputedProperty.ts]
|
|
declare const ab: { n: number } | { n: string };
|
|
const nameN = "n";
|
|
const { [nameN]: n } = ab;
|
|
|
|
class C { private p: number; }
|
|
const nameP = "p";
|
|
const { "p": p0 } = new C();
|
|
const { ["p"]: p1 } = new C();
|
|
const { [nameP]: p2 } = new C();
|
|
const { p: p3 } = new C();
|
|
|
|
|
|
//// [destructureComputedProperty.js]
|
|
"use strict";
|
|
const nameN = "n";
|
|
const { [nameN]: n } = ab;
|
|
class C {
|
|
}
|
|
const nameP = "p";
|
|
const { "p": p0 } = new C();
|
|
const { ["p"]: p1 } = new C();
|
|
const { [nameP]: p2 } = new C();
|
|
const { p: p3 } = new C();
|