1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
=== tests/cases/compiler/accessorDeclarationOrder.ts ===
class C1 {
>C1 : C1
#name: string;
>#name : string
public get name() {
>name : string
return this.#name;
>this.#name : string
>this : this
}
private set name(name: string) {
>name : string
>name : string
this.#name = name;
>this.#name = name : string
>this.#name : string
>this : this
>name : string
}
}
class C2 {
>C2 : C2
#name: string;
>#name : string
private set name(name: string) {
>name : string
>name : string
this.#name = name;
>this.#name = name : string
>this.#name : string
>this : this
>name : string
}
public get name() {
>name : string
return this.#name;
>this.#name : string
>this : this
}
}
const c1 = new C1();
>c1 : C1
>new C1() : C1
>C1 : typeof C1
const c2 = new C2();
>c2 : C2
>new C2() : C2
>C2 : typeof C2
// no error
c1.name;
>c1.name : string
>c1 : C1
>name : string
// no error
c2.name;
>c2.name : string
>c2 : C2
>name : string
|