fix(es/visit): Visit TypeScript satisfies expressions (#6511)

This commit is contained in:
Donny/강동윤 2022-11-25 20:28:01 +09:00 committed by GitHub
parent 2ce5e2287a
commit 0cee0e1af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 0 deletions

View File

@ -1133,6 +1133,14 @@ impl<'a> VisitMut for Resolver<'a> {
n.expr.visit_mut_with(self);
}
fn visit_mut_ts_satisfies_expr(&mut self, n: &mut TsSatisfiesExpr) {
if self.config.handle_types {
n.type_ann.visit_mut_with(self);
}
n.expr.visit_mut_with(self);
}
fn visit_mut_ts_call_signature_decl(&mut self, n: &mut TsCallSignatureDecl) {
if !self.config.handle_types {
return;

View File

@ -0,0 +1,11 @@
type Movable = {
move(distance: number): void;
};
const car = {
start() { },
move(d) {
// d should be number
},
stop() { }
} satisfies Movable & Record<string, unknown>;

View File

@ -0,0 +1,8 @@
type Movable__1 = {
move__0(distance: number): void;
};
const car__1 = {
start () {},
move (d__3) {},
stop () {}
} satisfies Movable__1 & Record<string, unknown>;

View File

@ -0,0 +1,11 @@
type Movable = {
move(distance: number): void;
};
const car = {
start() { },
move(d) {
// d should be number
},
stop() { }
} as Movable & Record<string, unknown>;

View File

@ -0,0 +1,8 @@
type Movable__1 = {
move__0(distance: number): void;
};
const car__1 = {
start () {},
move (d__3) {},
stop () {}
} as Movable__1 & Record<string, unknown>;

View File

@ -1816,6 +1816,12 @@ define!({
pub type_args: Box<TsTypeParamInstantiation>,
}
pub struct TsSatisfiesExpr {
pub span: Span,
pub expr: Box<Expr>,
pub type_ann: Box<TsType>,
}
pub struct ReservedUnused {
pub span: Span,
pub body: Option<Vec<ModuleItem>>,