Skip to content

Commit

Permalink
Handle TypeScript expressions in macro evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Oct 9, 2024
1 parent 6f68c78 commit 0bebfa6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,12 @@ impl<'a> Macros<'a> {
Err(opt.span)
}
}
Expr::TsAs(TsAsExpr { expr, .. })
| Expr::TsNonNull(TsNonNullExpr { expr, .. })
| Expr::TsSatisfies(TsSatisfiesExpr { expr, .. })
| Expr::TsTypeAssertion(TsTypeAssertion { expr, .. })
| Expr::TsInstantiation(TsInstantiation { expr, .. })
| Expr::TsConstAssertion(TsConstAssertion { expr, .. }) => self.eval(expr),
Expr::Fn(FnExpr { function, .. }) => Err(function.span),
Expr::Class(ClassExpr { class, .. }) => Err(class.span),
Expr::JSXElement(el) => Err(el.span),
Expand All @@ -663,7 +669,9 @@ impl<'a> Macros<'a> {
| Expr::Yield(YieldExpr { span, .. })
| Expr::Await(AwaitExpr { span, .. })
| Expr::JSXFragment(JSXFragment { span, .. })
| Expr::PrivateName(PrivateName { span, .. }) => Err(*span),
| Expr::PrivateName(PrivateName { span, .. })
| Expr::SuperProp(SuperPropExpr { span, .. })
| Expr::MetaProp(MetaPropExpr { span, .. }) => Err(*span),
_ => Err(DUMMY_SP),
}
}
Expand Down

0 comments on commit 0bebfa6

Please sign in to comment.