mirror of
https://github.com/swc-project/swc.git
synced 2024-12-01 01:13:56 +03:00
28 lines
487 B
TypeScript
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;
|
|
}
|
|
}
|