Skip to content

Commit 0bebfa6

Browse files
committed
Handle TypeScript expressions in macro evaluator
1 parent 6f68c78 commit 0bebfa6

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

crates/macros/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,12 @@ impl<'a> Macros<'a> {
649649
Err(opt.span)
650650
}
651651
}
652+
Expr::TsAs(TsAsExpr { expr, .. })
653+
| Expr::TsNonNull(TsNonNullExpr { expr, .. })
654+
| Expr::TsSatisfies(TsSatisfiesExpr { expr, .. })
655+
| Expr::TsTypeAssertion(TsTypeAssertion { expr, .. })
656+
| Expr::TsInstantiation(TsInstantiation { expr, .. })
657+
| Expr::TsConstAssertion(TsConstAssertion { expr, .. }) => self.eval(expr),
652658
Expr::Fn(FnExpr { function, .. }) => Err(function.span),
653659
Expr::Class(ClassExpr { class, .. }) => Err(class.span),
654660
Expr::JSXElement(el) => Err(el.span),
@@ -663,7 +669,9 @@ impl<'a> Macros<'a> {
663669
| Expr::Yield(YieldExpr { span, .. })
664670
| Expr::Await(AwaitExpr { span, .. })
665671
| Expr::JSXFragment(JSXFragment { span, .. })
666-
| Expr::PrivateName(PrivateName { span, .. }) => Err(*span),
672+
| Expr::PrivateName(PrivateName { span, .. })
673+
| Expr::SuperProp(SuperPropExpr { span, .. })
674+
| Expr::MetaProp(MetaPropExpr { span, .. }) => Err(*span),
667675
_ => Err(DUMMY_SP),
668676
}
669677
}

0 commit comments

Comments
 (0)