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.
This commit is contained in:
overlookmotel 2024-03-11 05:42:28 +00:00 committed by GitHub
parent 3a19169764
commit 3305734b34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1027,6 +1027,7 @@ pub enum AssignmentTargetPattern<'a> {
// See serializer in serialize.rs // See serializer in serialize.rs
#[derive(Debug, Hash, SerAttrs)] #[derive(Debug, Hash, SerAttrs)]
#[cfg_attr(feature = "wasm", derive(Tsify))] #[cfg_attr(feature = "wasm", derive(Tsify))]
#[serde(tag = "type")]
pub struct ArrayAssignmentTarget<'a> { pub struct ArrayAssignmentTarget<'a> {
#[serde(flatten)] #[serde(flatten)]
pub span: Span, pub span: Span,
@ -1049,6 +1050,7 @@ impl<'a> ArrayAssignmentTarget<'a> {
// See serializer in serialize.rs // See serializer in serialize.rs
#[derive(Debug, Hash, SerAttrs)] #[derive(Debug, Hash, SerAttrs)]
#[cfg_attr(feature = "wasm", derive(Tsify))] #[cfg_attr(feature = "wasm", derive(Tsify))]
#[serde(tag = "type")]
pub struct ObjectAssignmentTarget<'a> { pub struct ObjectAssignmentTarget<'a> {
#[serde(flatten)] #[serde(flatten)]
pub span: Span, pub span: Span,
@ -1765,6 +1767,7 @@ pub struct AssignmentPattern<'a> {
// See serializer in serialize.rs // See serializer in serialize.rs
#[derive(Debug, Hash, SerAttrs)] #[derive(Debug, Hash, SerAttrs)]
#[cfg_attr(feature = "wasm", derive(Tsify))] #[cfg_attr(feature = "wasm", derive(Tsify))]
#[serde(tag = "type")]
pub struct ObjectPattern<'a> { pub struct ObjectPattern<'a> {
#[serde(flatten)] #[serde(flatten)]
pub span: Span, pub span: Span,
@ -1800,6 +1803,7 @@ pub struct BindingProperty<'a> {
// See serializer in serialize.rs // See serializer in serialize.rs
#[derive(Debug, Hash, SerAttrs)] #[derive(Debug, Hash, SerAttrs)]
#[cfg_attr(feature = "wasm", derive(Tsify))] #[cfg_attr(feature = "wasm", derive(Tsify))]
#[serde(tag = "type")]
pub struct ArrayPattern<'a> { pub struct ArrayPattern<'a> {
#[serde(flatten)] #[serde(flatten)]
pub span: Span, pub span: Span,
@ -1909,6 +1913,7 @@ pub enum FunctionType {
// See serializer in serialize.rs // See serializer in serialize.rs
#[derive(Debug, Hash, SerAttrs)] #[derive(Debug, Hash, SerAttrs)]
#[cfg_attr(feature = "wasm", derive(Tsify))] #[cfg_attr(feature = "wasm", derive(Tsify))]
#[serde(tag = "type")]
pub struct FormalParameters<'a> { pub struct FormalParameters<'a> {
#[serde(flatten)] #[serde(flatten)]
pub span: Span, pub span: Span,