diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index 87978d359..3738334f1 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -836,7 +836,7 @@ pub struct TSMappedType<'a> { pub span: Span, pub type_parameter: Box<'a, TSTypeParameter<'a>>, pub name_type: Option>, - pub type_annotation: Option>>, + pub type_annotation: Option>, pub optional: TSMappedTypeModifierOperator, pub readonly: TSMappedTypeModifierOperator, } diff --git a/crates/oxc_ast/src/ast_builder.rs b/crates/oxc_ast/src/ast_builder.rs index 648ca6c5a..ea4ac4866 100644 --- a/crates/oxc_ast/src/ast_builder.rs +++ b/crates/oxc_ast/src/ast_builder.rs @@ -1667,7 +1667,7 @@ impl<'a> AstBuilder<'a> { span: Span, type_parameter: Box<'a, TSTypeParameter<'a>>, name_type: Option>, - type_annotation: Option>>, + type_annotation: Option>, optional: TSMappedTypeModifierOperator, readonly: TSMappedTypeModifierOperator, ) -> TSType<'a> { diff --git a/crates/oxc_ast/src/visit.rs b/crates/oxc_ast/src/visit.rs index 9e3ead8fc..ccfae6845 100644 --- a/crates/oxc_ast/src/visit.rs +++ b/crates/oxc_ast/src/visit.rs @@ -1668,7 +1668,7 @@ pub trait Visit<'a>: Sized { self.visit_ts_type(name); } if let Some(type_annotation) = &ty.type_annotation { - self.visit_ts_type_annotation(type_annotation); + self.visit_ts_type(type_annotation); } } diff --git a/crates/oxc_ast/src/visit_mut.rs b/crates/oxc_ast/src/visit_mut.rs index af5555171..c1abda805 100644 --- a/crates/oxc_ast/src/visit_mut.rs +++ b/crates/oxc_ast/src/visit_mut.rs @@ -1667,7 +1667,7 @@ pub trait VisitMut<'a>: Sized { self.visit_ts_type(name); } if let Some(type_annotation) = &mut ty.type_annotation { - self.visit_ts_type_annotation(type_annotation); + self.visit_ts_type(type_annotation); } } diff --git a/crates/oxc_parser/src/ts/types.rs b/crates/oxc_parser/src/ts/types.rs index ad2bfd6fc..11866f08c 100644 --- a/crates/oxc_parser/src/ts/types.rs +++ b/crates/oxc_parser/src/ts/types.rs @@ -662,7 +662,7 @@ impl<'a> ParserImpl<'a> { _ => TSMappedTypeModifierOperator::None, }; - let type_annotation = self.parse_ts_type_annotation()?; + let type_annotation = self.eat(Kind::Colon).then(|| self.parse_ts_type()).transpose()?; self.bump(Kind::Semicolon); self.expect(Kind::RCurly)?;