mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
65 lines
930 B
TypeScript
65 lines
930 B
TypeScript
//// [tests/cases/compiler/accessorDeclarationOrder.ts] ////
|
|
|
|
//// [accessorDeclarationOrder.ts]
|
|
class C1 {
|
|
#name: string;
|
|
|
|
public get name() {
|
|
return this.#name;
|
|
}
|
|
|
|
private set name(name: string) {
|
|
this.#name = name;
|
|
}
|
|
}
|
|
|
|
class C2 {
|
|
#name: string;
|
|
|
|
private set name(name: string) {
|
|
this.#name = name;
|
|
}
|
|
|
|
public get name() {
|
|
return this.#name;
|
|
}
|
|
}
|
|
|
|
const c1 = new C1();
|
|
const c2 = new C2();
|
|
|
|
|
|
// no error
|
|
c1.name;
|
|
|
|
// no error
|
|
c2.name;
|
|
|
|
|
|
//// [accessorDeclarationOrder.js]
|
|
"use strict";
|
|
class C1 {
|
|
#name;
|
|
get name() {
|
|
return this.#name;
|
|
}
|
|
set name(name) {
|
|
this.#name = name;
|
|
}
|
|
}
|
|
class C2 {
|
|
#name;
|
|
set name(name) {
|
|
this.#name = name;
|
|
}
|
|
get name() {
|
|
return this.#name;
|
|
}
|
|
}
|
|
const c1 = new C1();
|
|
const c2 = new C2();
|
|
// no error
|
|
c1.name;
|
|
// no error
|
|
c2.name;
|