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

30 lines
527 B
TypeScript

// @strict: true
// @target: es6
class A {
#foo = true;
static #baz = 10;
static #m() {}
method(thing: any) {
thing.#foo; // OK
thing.#m();
thing.#baz;
thing.#bar; // Error
thing.#foo();
}
methodU(thing: unknown) {
thing.#foo;
thing.#m();
thing.#baz;
thing.#bar;
thing.#foo();
}
methodN(thing: never) {
thing.#foo;
thing.#m();
thing.#baz;
thing.#bar;
thing.#foo();
}
};