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

28 lines
487 B
TypeScript

// @strict: true
// @target: esnext, es2022
// @useDefineForClassFields: false
class Foo {
#p1: (v: any) => asserts v is string = (v) => {
if (typeof v !== "string") {
throw new Error();
}
}
m1(v: unknown) {
this.#p1(v);
v;
}
}
class Foo2 {
#p1(v: any): asserts v is string {
if (typeof v !== "string") {
throw new Error();
}
}
m1(v: unknown) {
this.#p1(v);
v;
}
}