mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 20:28:43 +03:00
fix(es/visit): Visit TypeScript satisfies expressions (#6511)
This commit is contained in:
parent
2ce5e2287a
commit
0cee0e1af7
@ -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;
|
||||
|
@ -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>;
|
@ -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>;
|
@ -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>;
|
@ -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>;
|
@ -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>>,
|
||||
|
Loading…
Reference in New Issue
Block a user