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
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ pub struct AssignmentPattern<'a> {
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
#[estree(add_fields(decorators = TsEmptyArray))]
#[estree(add_fields(decorators = TsEmptyArray, optional = TsFalse, typeAnnotation = TsNull))]
pub struct ObjectPattern<'a> {
pub span: Span,
pub properties: Vec<'a, BindingProperty<'a>>,
Expand Down
2 changes: 2 additions & 0 deletions crates/oxc_ast/src/generated/derive_estree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,8 @@ impl ESTree for ObjectPattern<'_> {
&AppendTo { array: &self.properties, after: &self.rest },
);
state.serialize_ts_field("decorators", &crate::serialize::TsEmptyArray(self));
state.serialize_ts_field("optional", &crate::serialize::TsFalse(self));
state.serialize_ts_field("typeAnnotation", &crate::serialize::TsNull(self));
state.end();
}
}
Expand Down
2 changes: 2 additions & 0 deletions napi/parser/deserialize-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,8 @@ function deserializeObjectPattern(pos) {
end: deserializeU32(pos + 4),
properties,
decorators: [],
optional: false,
typeAnnotation: null,
};
}

Expand Down
2 changes: 2 additions & 0 deletions npm/oxc-types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ export interface ObjectPattern extends Span {
type: 'ObjectPattern';
properties: Array<BindingProperty | BindingRestElement>;
decorators?: [];
optional?: false;
typeAnnotation?: null;
}

export interface BindingProperty extends Span {
Expand Down
3 changes: 1 addition & 2 deletions tasks/coverage/snapshots/estree_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ commit: 15392346

estree_typescript Summary:
AST Parsed : 10619/10725 (99.01%)
Positive Passed: 9326/10725 (86.96%)
Positive Passed: 9327/10725 (86.97%)
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts
A class member cannot have the 'const' keyword.
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/accessorBodyInTypeContext.ts
Expand Down Expand Up @@ -750,7 +750,6 @@ Unexpected token
Mismatch: tasks/coverage/typescript/tests/cases/compiler/restParameterAssignmentCompatibility.ts
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/restParameterNotLast.ts
A rest parameter must be last in a parameter list
Mismatch: tasks/coverage/typescript/tests/cases/compiler/restParameterWithBindingPattern1.ts
Expect to Parse: tasks/coverage/typescript/tests/cases/compiler/restParameterWithBindingPattern3.ts
A rest element cannot have an initializer.
tasks/coverage/typescript/tests/cases/compiler/reuseTypeAnnotationImportTypeInGlobalThisTypeArgument.ts
Expand Down
Loading