From e8b2e1e2477a2133b4a66094817246c4a285db02 Mon Sep 17 00:00:00 2001 From: magic-akari Date: Fri, 7 Apr 2023 20:02:37 +0800 Subject: [PATCH] Handle ObjectPat optional --- crates/swc_ecma_transforms_typescript/src/strip_type.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/swc_ecma_transforms_typescript/src/strip_type.rs b/crates/swc_ecma_transforms_typescript/src/strip_type.rs index 24199ffa21b86..0516b2f93becb 100644 --- a/crates/swc_ecma_transforms_typescript/src/strip_type.rs +++ b/crates/swc_ecma_transforms_typescript/src/strip_type.rs @@ -109,6 +109,11 @@ impl VisitMut for StripType { n.optional = false; } + fn visit_mut_object_pat(&mut self, pat: &mut ObjectPat) { + pat.visit_mut_children_with(self); + pat.optional = false; + } + fn visit_mut_expr(&mut self, n: &mut Expr) { match n { // https://github.com/tc39/proposal-type-annotations#type-assertions