From 3305734b34a76c03618b0691956b93cb5f70845d Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Mon, 11 Mar 2024 05:42:28 +0000 Subject: [PATCH] fix(ast): add `type` field to TS types for `ObjectPattern` etc (#2670) Fixes #2658 (details given in https://github.com/oxc-project/oxc/issues/2657#issuecomment-1987289481). Add `type` fields to TS types for `ObjectPattern`, `ArrayPattern` etc which were missing previously. --- crates/oxc_ast/src/ast/js.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index 077ad4933..130d50c52 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -1027,6 +1027,7 @@ pub enum AssignmentTargetPattern<'a> { // See serializer in serialize.rs #[derive(Debug, Hash, SerAttrs)] #[cfg_attr(feature = "wasm", derive(Tsify))] +#[serde(tag = "type")] pub struct ArrayAssignmentTarget<'a> { #[serde(flatten)] pub span: Span, @@ -1049,6 +1050,7 @@ impl<'a> ArrayAssignmentTarget<'a> { // See serializer in serialize.rs #[derive(Debug, Hash, SerAttrs)] #[cfg_attr(feature = "wasm", derive(Tsify))] +#[serde(tag = "type")] pub struct ObjectAssignmentTarget<'a> { #[serde(flatten)] pub span: Span, @@ -1765,6 +1767,7 @@ pub struct AssignmentPattern<'a> { // See serializer in serialize.rs #[derive(Debug, Hash, SerAttrs)] #[cfg_attr(feature = "wasm", derive(Tsify))] +#[serde(tag = "type")] pub struct ObjectPattern<'a> { #[serde(flatten)] pub span: Span, @@ -1800,6 +1803,7 @@ pub struct BindingProperty<'a> { // See serializer in serialize.rs #[derive(Debug, Hash, SerAttrs)] #[cfg_attr(feature = "wasm", derive(Tsify))] +#[serde(tag = "type")] pub struct ArrayPattern<'a> { #[serde(flatten)] pub span: Span, @@ -1909,6 +1913,7 @@ pub enum FunctionType { // See serializer in serialize.rs #[derive(Debug, Hash, SerAttrs)] #[cfg_attr(feature = "wasm", derive(Tsify))] +#[serde(tag = "type")] pub struct FormalParameters<'a> { #[serde(flatten)] pub span: Span,