swc/crates/swc_ecma_parser/tests/tsc/privateNamesAndMethods.ts
2022-02-04 17:08:38 +09:00

34 lines
616 B
TypeScript

// @target: esnext, es2022
// @lib: esnext, es2022
// @useDefineForClassFields: false
class A {
#foo(a: number) {}
async #bar(a: number) {}
async *#baz(a: number) {
return 3;
}
#_quux: number;
get #quux (): number {
return this.#_quux;
}
set #quux (val: number) {
this.#_quux = val;
}
constructor () {
this.#foo(30);
this.#bar(30);
this.#baz(30);
this.#quux = this.#quux + 1;
this.#quux++;
}
}
class B extends A {
#foo(a: string) {}
constructor () {
super();
this.#foo("str");
}
}