mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
31 lines
519 B
TypeScript
31 lines
519 B
TypeScript
//// [tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts] ////
|
|
|
|
//// [classStaticBlock11.ts]
|
|
let getX;
|
|
class C {
|
|
#x = 1
|
|
constructor(x: number) {
|
|
this.#x = x;
|
|
}
|
|
|
|
static {
|
|
// getX has privileged access to #x
|
|
getX = (obj: C) => obj.#x;
|
|
}
|
|
}
|
|
|
|
|
|
//// [classStaticBlock11.js]
|
|
"use strict";
|
|
let getX;
|
|
class C {
|
|
#x = 1;
|
|
constructor(x) {
|
|
this.#x = x;
|
|
}
|
|
static {
|
|
// getX has privileged access to #x
|
|
getX = (obj) => obj.#x;
|
|
}
|
|
}
|