From 3cbe786b1883397c5b566081d5f33cca4deb2cdc Mon Sep 17 00:00:00 2001 From: Dunqing Date: Mon, 19 Feb 2024 10:29:24 +0800 Subject: [PATCH] refactor(ast): update TSImportType parameter to argument (#2429) In typescript it's named argument, so we should keep it consistent https://github.com/microsoft/TypeScript/blob/64d2eeea7b9c7f1a79edf42cb99f302535136a2e/src/compiler/types.ts#L2180 --- crates/oxc_ast/src/ast/ts.rs | 2 +- crates/oxc_ast/src/ast_builder.rs | 4 ++-- crates/oxc_parser/src/ts/types.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index ed66f2e6e..c24050be0 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -776,7 +776,7 @@ pub struct TSImportType<'a> { #[cfg_attr(feature = "serde", serde(flatten))] pub span: Span, pub is_type_of: bool, - pub parameter: TSType<'a>, + pub argument: TSType<'a>, pub qualifier: Option>, pub type_parameters: Option>>, } diff --git a/crates/oxc_ast/src/ast_builder.rs b/crates/oxc_ast/src/ast_builder.rs index e17ace890..66aef8502 100644 --- a/crates/oxc_ast/src/ast_builder.rs +++ b/crates/oxc_ast/src/ast_builder.rs @@ -1650,14 +1650,14 @@ impl<'a> AstBuilder<'a> { &self, span: Span, is_type_of: bool, - parameter: TSType<'a>, + argument: TSType<'a>, qualifier: Option>, type_parameters: Option>>, ) -> TSType<'a> { TSType::TSImportType(self.alloc(TSImportType { span, is_type_of, - parameter, + argument, qualifier, type_parameters, })) diff --git a/crates/oxc_parser/src/ts/types.rs b/crates/oxc_parser/src/ts/types.rs index ca1362a9c..541f26ec6 100644 --- a/crates/oxc_parser/src/ts/types.rs +++ b/crates/oxc_parser/src/ts/types.rs @@ -762,7 +762,7 @@ impl<'a> ParserImpl<'a> { let is_type_of = self.eat(Kind::Typeof); self.expect(Kind::Import)?; self.expect(Kind::LParen)?; - let parameter = self.parse_ts_type()?; + let argument = self.parse_ts_type()?; self.expect(Kind::RParen)?; let qualifier = if self.eat(Kind::Dot) { Some(self.parse_ts_type_name()?) } else { None }; @@ -772,7 +772,7 @@ impl<'a> ParserImpl<'a> { Ok(self.ast.ts_import_type( self.end_span(span), is_type_of, - parameter, + argument, qualifier, type_parameters, ))