@oxc-project/types 0.49.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +57 -64
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-project/types",
3
- "version": "0.49.0",
3
+ "version": "0.51.0",
4
4
  "description": "Types for Oxc AST nodes",
5
5
  "keywords": [
6
6
  "AST",
package/types.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
 
4
4
  export interface Program extends Span {
5
5
  type: 'Program';
6
+ body: Array<Directive | Statement>;
6
7
  sourceType: ModuleKind;
7
8
  hashbang: Hashbang | null;
8
- body: Array<Directive | Statement>;
9
9
  }
10
10
 
11
11
  export type Expression =
@@ -90,12 +90,12 @@ export type ObjectPropertyKind = ObjectProperty | SpreadElement;
90
90
 
91
91
  export interface ObjectProperty extends Span {
92
92
  type: 'Property';
93
- kind: PropertyKind;
94
- key: PropertyKey;
95
- value: Expression;
96
93
  method: boolean;
97
94
  shorthand: boolean;
98
95
  computed: boolean;
96
+ key: PropertyKey;
97
+ kind: PropertyKind;
98
+ value: Expression;
99
99
  }
100
100
 
101
101
  export type PropertyKey = IdentifierName | PrivateIdentifier | Expression;
@@ -104,8 +104,8 @@ export type PropertyKind = 'init' | 'get' | 'set';
104
104
 
105
105
  export interface TemplateLiteral extends Span {
106
106
  type: 'TemplateLiteral';
107
- quasis: Array<TemplateElement>;
108
107
  expressions: Array<Expression>;
108
+ quasis: Array<TemplateElement>;
109
109
  }
110
110
 
111
111
  export interface TaggedTemplateExpression extends Span {
@@ -117,8 +117,8 @@ export interface TaggedTemplateExpression extends Span {
117
117
 
118
118
  export interface TemplateElement extends Span {
119
119
  type: 'TemplateElement';
120
- tail: boolean;
121
120
  value: TemplateElementValue;
121
+ tail: boolean;
122
122
  }
123
123
 
124
124
  export interface TemplateElementValue {
@@ -132,24 +132,24 @@ export interface ComputedMemberExpression extends Span {
132
132
  type: 'MemberExpression';
133
133
  object: Expression;
134
134
  property: Expression;
135
- optional: boolean;
136
135
  computed: true;
136
+ optional: boolean;
137
137
  }
138
138
 
139
139
  export interface StaticMemberExpression extends Span {
140
140
  type: 'MemberExpression';
141
141
  object: Expression;
142
142
  property: IdentifierName;
143
- optional: boolean;
144
143
  computed: false;
144
+ optional: boolean;
145
145
  }
146
146
 
147
147
  export interface PrivateFieldExpression extends Span {
148
148
  type: 'MemberExpression';
149
149
  object: Expression;
150
- field: PrivateIdentifier;
151
- optional: boolean;
150
+ property: PrivateIdentifier;
152
151
  computed: false;
152
+ optional: boolean;
153
153
  }
154
154
 
155
155
  export interface CallExpression extends Span {
@@ -190,8 +190,8 @@ export interface UpdateExpression extends Span {
190
190
  export interface UnaryExpression extends Span {
191
191
  type: 'UnaryExpression';
192
192
  operator: UnaryOperator;
193
- argument: Expression;
194
193
  prefix: true;
194
+ argument: Expression;
195
195
  }
196
196
 
197
197
  export interface BinaryExpression extends Span {
@@ -202,9 +202,9 @@ export interface BinaryExpression extends Span {
202
202
  }
203
203
 
204
204
  export interface PrivateInExpression extends Span {
205
- type: 'PrivateInExpression';
205
+ type: 'BinaryExpression';
206
206
  left: PrivateIdentifier;
207
- operator: BinaryOperator;
207
+ operator: 'in';
208
208
  right: Expression;
209
209
  }
210
210
 
@@ -268,19 +268,23 @@ export interface AssignmentTargetWithDefault extends Span {
268
268
  export type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty;
269
269
 
270
270
  export interface AssignmentTargetPropertyIdentifier extends Span {
271
- type: 'AssignmentTargetPropertyIdentifier';
272
- binding: IdentifierReference;
273
- init: Expression | null;
271
+ type: 'Property';
272
+ method: false;
273
+ shorthand: true;
274
+ computed: false;
275
+ key: IdentifierReference;
276
+ kind: 'init';
277
+ value: IdentifierReference | AssignmentTargetWithDefault;
274
278
  }
275
279
 
276
280
  export interface AssignmentTargetPropertyProperty extends Span {
277
281
  type: 'Property';
282
+ method: false;
283
+ shorthand: false;
284
+ computed: boolean;
278
285
  key: PropertyKey;
279
286
  value: AssignmentTargetMaybeDefault;
280
- computed: boolean;
281
287
  kind: 'init';
282
- method: false;
283
- shorthand: false;
284
288
  }
285
289
 
286
290
  export interface SequenceExpression extends Span {
@@ -359,8 +363,8 @@ export type Declaration =
359
363
 
360
364
  export interface VariableDeclaration extends Span {
361
365
  type: 'VariableDeclaration';
362
- kind: VariableDeclarationKind;
363
366
  declarations: Array<VariableDeclarator>;
367
+ kind: VariableDeclarationKind;
364
368
  declare: boolean;
365
369
  }
366
370
 
@@ -457,14 +461,14 @@ export interface SwitchStatement extends Span {
457
461
 
458
462
  export interface SwitchCase extends Span {
459
463
  type: 'SwitchCase';
460
- test: Expression | null;
461
464
  consequent: Array<Statement>;
465
+ test: Expression | null;
462
466
  }
463
467
 
464
468
  export interface LabeledStatement extends Span {
465
469
  type: 'LabeledStatement';
466
- label: LabelIdentifier;
467
470
  body: Statement;
471
+ label: LabelIdentifier;
468
472
  }
469
473
 
470
474
  export interface ThrowStatement extends Span {
@@ -481,17 +485,10 @@ export interface TryStatement extends Span {
481
485
 
482
486
  export interface CatchClause extends Span {
483
487
  type: 'CatchClause';
484
- param: CatchParameter | null;
488
+ param: BindingPattern | null;
485
489
  body: BlockStatement;
486
490
  }
487
491
 
488
- export type CatchParameter =
489
- & ({
490
- type: 'CatchParameter';
491
- })
492
- & Span
493
- & BindingPattern;
494
-
495
492
  export interface DebuggerStatement extends Span {
496
493
  type: 'DebuggerStatement';
497
494
  }
@@ -518,12 +515,12 @@ export interface ObjectPattern extends Span {
518
515
 
519
516
  export interface BindingProperty extends Span {
520
517
  type: 'Property';
521
- key: PropertyKey;
522
- value: BindingPattern;
518
+ method: false;
523
519
  shorthand: boolean;
524
520
  computed: boolean;
521
+ key: PropertyKey;
525
522
  kind: 'init';
526
- method: false;
523
+ value: BindingPattern;
527
524
  }
528
525
 
529
526
  export interface ArrayPattern extends Span {
@@ -539,15 +536,15 @@ export interface BindingRestElement extends Span {
539
536
  export interface Function extends Span {
540
537
  type: FunctionType;
541
538
  id: BindingIdentifier | null;
539
+ expression: false;
542
540
  generator: boolean;
543
541
  async: boolean;
542
+ params: ParamPattern[];
543
+ body: FunctionBody | null;
544
544
  declare: boolean;
545
545
  typeParameters: TSTypeParameterDeclaration | null;
546
546
  thisParam: TSThisParameter | null;
547
- params: ParamPattern[];
548
547
  returnType: TSTypeAnnotation | null;
549
- body: FunctionBody | null;
550
- expression: false;
551
548
  }
552
549
 
553
550
  export type ParamPattern = FormalParameter | FormalParameterRest;
@@ -578,8 +575,7 @@ export type FormalParameter =
578
575
  readonly: boolean;
579
576
  override: boolean;
580
577
  })
581
- & Span
582
- & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern);
578
+ & BindingPattern;
583
579
 
584
580
  export type FormalParameterKind = 'FormalParameter' | 'UniqueFormalParameters' | 'ArrowFormalParameters' | 'Signature';
585
581
 
@@ -590,14 +586,14 @@ export interface FunctionBody extends Span {
590
586
 
591
587
  export interface ArrowFunctionExpression extends Span {
592
588
  type: 'ArrowFunctionExpression';
589
+ id: null;
593
590
  expression: boolean;
591
+ generator: false;
594
592
  async: boolean;
595
- typeParameters: TSTypeParameterDeclaration | null;
596
593
  params: ParamPattern[];
597
- returnType: TSTypeAnnotation | null;
598
594
  body: FunctionBody | Expression;
599
- generator: false;
600
- id: null;
595
+ typeParameters: TSTypeParameterDeclaration | null;
596
+ returnType: TSTypeAnnotation | null;
601
597
  }
602
598
 
603
599
  export interface YieldExpression extends Span {
@@ -608,13 +604,13 @@ export interface YieldExpression extends Span {
608
604
 
609
605
  export interface Class extends Span {
610
606
  type: ClassType;
611
- decorators: Array<Decorator>;
612
607
  id: BindingIdentifier | null;
613
- typeParameters: TSTypeParameterDeclaration | null;
614
608
  superClass: Expression | null;
609
+ body: ClassBody;
610
+ decorators: Array<Decorator>;
611
+ typeParameters: TSTypeParameterDeclaration | null;
615
612
  superTypeParameters: TSTypeParameterInstantiation | null;
616
613
  implements: Array<TSClassImplements> | null;
617
- body: ClassBody;
618
614
  abstract: boolean;
619
615
  declare: boolean;
620
616
  }
@@ -630,12 +626,12 @@ export type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition |
630
626
 
631
627
  export interface MethodDefinition extends Span {
632
628
  type: MethodDefinitionType;
633
- decorators: Array<Decorator>;
629
+ static: boolean;
630
+ computed: boolean;
634
631
  key: PropertyKey;
635
- value: Function;
636
632
  kind: MethodDefinitionKind;
637
- computed: boolean;
638
- static: boolean;
633
+ value: Function;
634
+ decorators: Array<Decorator>;
639
635
  override: boolean;
640
636
  optional: boolean;
641
637
  accessibility: TSAccessibility | null;
@@ -645,11 +641,11 @@ export type MethodDefinitionType = 'MethodDefinition' | 'TSAbstractMethodDefinit
645
641
 
646
642
  export interface PropertyDefinition extends Span {
647
643
  type: PropertyDefinitionType;
648
- decorators: Array<Decorator>;
644
+ static: boolean;
645
+ computed: boolean;
649
646
  key: PropertyKey;
650
647
  value: Expression | null;
651
- computed: boolean;
652
- static: boolean;
648
+ decorators: Array<Decorator>;
653
649
  declare: boolean;
654
650
  override: boolean;
655
651
  optional: boolean;
@@ -685,11 +681,11 @@ export type AccessorPropertyType = 'AccessorProperty' | 'TSAbstractAccessorPrope
685
681
 
686
682
  export interface AccessorProperty extends Span {
687
683
  type: AccessorPropertyType;
688
- decorators: Array<Decorator>;
689
684
  key: PropertyKey;
690
685
  value: Expression | null;
691
686
  computed: boolean;
692
687
  static: boolean;
688
+ decorators: Array<Decorator>;
693
689
  definite: boolean;
694
690
  typeAnnotation: TSTypeAnnotation | null;
695
691
  accessibility: TSAccessibility | null;
@@ -698,8 +694,7 @@ export interface AccessorProperty extends Span {
698
694
  export interface ImportExpression extends Span {
699
695
  type: 'ImportExpression';
700
696
  source: Expression;
701
- arguments: Array<Expression>;
702
- phase: ImportPhase | null;
697
+ options: Expression | null;
703
698
  }
704
699
 
705
700
  export interface ImportDeclaration extends Span {
@@ -707,7 +702,7 @@ export interface ImportDeclaration extends Span {
707
702
  specifiers: Array<ImportDeclarationSpecifier>;
708
703
  source: StringLiteral;
709
704
  phase: ImportPhase | null;
710
- withClause: WithClause | null;
705
+ attributes: Array<ImportAttribute>;
711
706
  importKind: ImportOrExportKind;
712
707
  }
713
708
 
@@ -752,7 +747,7 @@ export interface ExportNamedDeclaration extends Span {
752
747
  specifiers: Array<ExportSpecifier>;
753
748
  source: StringLiteral | null;
754
749
  exportKind: ImportOrExportKind;
755
- withClause: WithClause | null;
750
+ attributes: Array<ImportAttribute>;
756
751
  }
757
752
 
758
753
  export interface ExportDefaultDeclaration extends Span {
@@ -765,7 +760,7 @@ export interface ExportAllDeclaration extends Span {
765
760
  type: 'ExportAllDeclaration';
766
761
  exported: ModuleExportName | null;
767
762
  source: StringLiteral;
768
- withClause: WithClause | null;
763
+ attributes: Array<ImportAttribute>;
769
764
  exportKind: ImportOrExportKind;
770
765
  }
771
766
 
@@ -806,16 +801,16 @@ export interface StringLiteral extends Span {
806
801
 
807
802
  export interface BigIntLiteral extends Span {
808
803
  type: 'Literal';
804
+ value: BigInt;
809
805
  raw: string | null;
810
- value: null;
811
806
  bigint: string;
812
807
  }
813
808
 
814
809
  export interface RegExpLiteral extends Span {
815
810
  type: 'Literal';
816
- regex: RegExp;
811
+ value: RegExp | null;
817
812
  raw: string | null;
818
- value: {} | null;
813
+ regex: RegExp;
819
814
  }
820
815
 
821
816
  export interface RegExp {
@@ -955,7 +950,6 @@ export type TSLiteral =
955
950
  | NullLiteral
956
951
  | NumericLiteral
957
952
  | BigIntLiteral
958
- | RegExpLiteral
959
953
  | StringLiteral
960
954
  | TemplateLiteral
961
955
  | UnaryExpression;
@@ -985,7 +979,6 @@ export type TSType =
985
979
  | TSLiteralType
986
980
  | TSMappedType
987
981
  | TSNamedTupleMember
988
- | TSQualifiedName
989
982
  | TSTemplateLiteralType
990
983
  | TSThisType
991
984
  | TSTupleType
@@ -1276,7 +1269,7 @@ export type TSModuleDeclarationBody = TSModuleDeclaration | TSModuleBlock;
1276
1269
 
1277
1270
  export interface TSModuleBlock extends Span {
1278
1271
  type: 'TSModuleBlock';
1279
- body: Array<Statement>;
1272
+ body: Array<Directive | Statement>;
1280
1273
  }
1281
1274
 
1282
1275
  export interface TSTypeLiteral extends Span {