Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ pub enum ObjectPropertyKind<'a> {
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
#[estree(rename = "Property")]
pub struct ObjectProperty<'a> {
pub span: Span,
pub kind: PropertyKind,
Expand Down Expand Up @@ -1476,6 +1477,11 @@ pub struct ObjectPattern<'a> {
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
#[estree(
rename = "Property",
add_fields(kind = "\"init\"", method = false),
add_ts = "kind: \"init\"; method: false"
)]
pub struct BindingProperty<'a> {
pub span: Span,
pub key: PropertyKey<'a>,
Expand Down
6 changes: 4 additions & 2 deletions crates/oxc_ast/src/generated/derive_estree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl Serialize for ObjectPropertyKind<'_> {
impl Serialize for ObjectProperty<'_> {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut map = serializer.serialize_map(None)?;
map.serialize_entry("type", "ObjectProperty")?;
map.serialize_entry("type", "Property")?;
map.serialize_entry("start", &self.span.start)?;
map.serialize_entry("end", &self.span.end)?;
map.serialize_entry("kind", &self.kind)?;
Expand Down Expand Up @@ -1287,13 +1287,15 @@ impl Serialize for ObjectPattern<'_> {
impl Serialize for BindingProperty<'_> {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut map = serializer.serialize_map(None)?;
map.serialize_entry("type", "BindingProperty")?;
map.serialize_entry("type", "Property")?;
map.serialize_entry("start", &self.span.start)?;
map.serialize_entry("end", &self.span.end)?;
map.serialize_entry("key", &self.key)?;
map.serialize_entry("value", &self.value)?;
map.serialize_entry("shorthand", &self.shorthand)?;
map.serialize_entry("computed", &self.computed)?;
map.serialize_entry("kind", &"init")?;
map.serialize_entry("method", &false)?;
map.end()
}
}
Expand Down
6 changes: 4 additions & 2 deletions npm/oxc-types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface ObjectExpression extends Span {
export type ObjectPropertyKind = ObjectProperty | SpreadElement;

export interface ObjectProperty extends Span {
type: 'ObjectProperty';
type: 'Property';
kind: PropertyKind;
key: PropertyKey;
value: Expression;
Expand Down Expand Up @@ -513,11 +513,13 @@ export interface ObjectPattern extends Span {
}

export interface BindingProperty extends Span {
type: 'BindingProperty';
type: 'Property';
key: PropertyKey;
value: BindingPattern;
shorthand: boolean;
computed: boolean;
kind: 'init';
method: false;
}

export interface ArrayPattern extends Span {
Expand Down
Loading
Loading