// @strict: true // @target: es6 class C { #foo: T; #bar(): T { return this.#foo; } constructor(t: T) { this.#foo = t; t = this.#bar(); } set baz(t: T) { this.#foo = t; } get baz(): T { return this.#foo; } } let a = new C(3); let b = new C("hello"); a.baz = 5 // OK const x: number = a.baz // OK a.#foo; // Error a = b; // Error b = a; // Error