@oxc-project/types 0.50.0 → 0.52.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 +46 -63
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-project/types",
3
- "version": "0.50.0",
3
+ "version": "0.52.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
150
  property: PrivateIdentifier;
151
- optional: boolean;
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 {
@@ -204,8 +204,8 @@ export interface BinaryExpression extends Span {
204
204
  export interface PrivateInExpression extends Span {
205
205
  type: 'BinaryExpression';
206
206
  left: PrivateIdentifier;
207
- right: Expression;
208
207
  operator: 'in';
208
+ right: Expression;
209
209
  }
210
210
 
211
211
  export interface LogicalExpression extends Span {
@@ -269,22 +269,22 @@ export type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | Assi
269
269
 
270
270
  export interface AssignmentTargetPropertyIdentifier extends Span {
271
271
  type: 'Property';
272
- key: IdentifierReference;
273
- value: IdentifierReference | AssignmentTargetWithDefault;
274
- kind: 'init';
275
272
  method: false;
276
- shorthand: false;
273
+ shorthand: true;
277
274
  computed: false;
275
+ key: IdentifierReference;
276
+ kind: 'init';
277
+ value: IdentifierReference | AssignmentTargetWithDefault;
278
278
  }
279
279
 
280
280
  export interface AssignmentTargetPropertyProperty extends Span {
281
281
  type: 'Property';
282
+ method: false;
283
+ shorthand: false;
284
+ computed: boolean;
282
285
  key: PropertyKey;
283
286
  value: AssignmentTargetMaybeDefault;
284
- computed: boolean;
285
287
  kind: 'init';
286
- method: false;
287
- shorthand: false;
288
288
  }
289
289
 
290
290
  export interface SequenceExpression extends Span {
@@ -363,8 +363,8 @@ export type Declaration =
363
363
 
364
364
  export interface VariableDeclaration extends Span {
365
365
  type: 'VariableDeclaration';
366
- kind: VariableDeclarationKind;
367
366
  declarations: Array<VariableDeclarator>;
367
+ kind: VariableDeclarationKind;
368
368
  declare: boolean;
369
369
  }
370
370
 
@@ -461,14 +461,14 @@ export interface SwitchStatement extends Span {
461
461
 
462
462
  export interface SwitchCase extends Span {
463
463
  type: 'SwitchCase';
464
- test: Expression | null;
465
464
  consequent: Array<Statement>;
465
+ test: Expression | null;
466
466
  }
467
467
 
468
468
  export interface LabeledStatement extends Span {
469
469
  type: 'LabeledStatement';
470
- label: LabelIdentifier;
471
470
  body: Statement;
471
+ label: LabelIdentifier;
472
472
  }
473
473
 
474
474
  export interface ThrowStatement extends Span {
@@ -485,17 +485,10 @@ export interface TryStatement extends Span {
485
485
 
486
486
  export interface CatchClause extends Span {
487
487
  type: 'CatchClause';
488
- param: CatchParameter | null;
488
+ param: BindingPattern | null;
489
489
  body: BlockStatement;
490
490
  }
491
491
 
492
- export type CatchParameter =
493
- & ({
494
- type: 'CatchParameter';
495
- })
496
- & Span
497
- & BindingPattern;
498
-
499
492
  export interface DebuggerStatement extends Span {
500
493
  type: 'DebuggerStatement';
501
494
  }
@@ -522,12 +515,12 @@ export interface ObjectPattern extends Span {
522
515
 
523
516
  export interface BindingProperty extends Span {
524
517
  type: 'Property';
525
- key: PropertyKey;
526
- value: BindingPattern;
518
+ method: false;
527
519
  shorthand: boolean;
528
520
  computed: boolean;
521
+ key: PropertyKey;
529
522
  kind: 'init';
530
- method: false;
523
+ value: BindingPattern;
531
524
  }
532
525
 
533
526
  export interface ArrayPattern extends Span {
@@ -543,15 +536,15 @@ export interface BindingRestElement extends Span {
543
536
  export interface Function extends Span {
544
537
  type: FunctionType;
545
538
  id: BindingIdentifier | null;
539
+ expression: false;
546
540
  generator: boolean;
547
541
  async: boolean;
542
+ params: ParamPattern[];
543
+ body: FunctionBody | null;
548
544
  declare: boolean;
549
545
  typeParameters: TSTypeParameterDeclaration | null;
550
546
  thisParam: TSThisParameter | null;
551
- params: ParamPattern[];
552
547
  returnType: TSTypeAnnotation | null;
553
- body: FunctionBody | null;
554
- expression: false;
555
548
  }
556
549
 
557
550
  export type ParamPattern = FormalParameter | FormalParameterRest;
@@ -582,7 +575,6 @@ export type FormalParameter =
582
575
  readonly: boolean;
583
576
  override: boolean;
584
577
  })
585
- & Span
586
578
  & BindingPattern;
587
579
 
588
580
  export type FormalParameterKind = 'FormalParameter' | 'UniqueFormalParameters' | 'ArrowFormalParameters' | 'Signature';
@@ -594,14 +586,14 @@ export interface FunctionBody extends Span {
594
586
 
595
587
  export interface ArrowFunctionExpression extends Span {
596
588
  type: 'ArrowFunctionExpression';
589
+ id: null;
597
590
  expression: boolean;
591
+ generator: false;
598
592
  async: boolean;
599
- typeParameters: TSTypeParameterDeclaration | null;
600
593
  params: ParamPattern[];
601
- returnType: TSTypeAnnotation | null;
602
594
  body: FunctionBody | Expression;
603
- generator: false;
604
- id: null;
595
+ typeParameters: TSTypeParameterDeclaration | null;
596
+ returnType: TSTypeAnnotation | null;
605
597
  }
606
598
 
607
599
  export interface YieldExpression extends Span {
@@ -612,13 +604,13 @@ export interface YieldExpression extends Span {
612
604
 
613
605
  export interface Class extends Span {
614
606
  type: ClassType;
615
- decorators: Array<Decorator>;
616
607
  id: BindingIdentifier | null;
617
- typeParameters: TSTypeParameterDeclaration | null;
618
608
  superClass: Expression | null;
609
+ body: ClassBody;
610
+ decorators: Array<Decorator>;
611
+ typeParameters: TSTypeParameterDeclaration | null;
619
612
  superTypeParameters: TSTypeParameterInstantiation | null;
620
613
  implements: Array<TSClassImplements> | null;
621
- body: ClassBody;
622
614
  abstract: boolean;
623
615
  declare: boolean;
624
616
  }
@@ -634,12 +626,12 @@ export type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition |
634
626
 
635
627
  export interface MethodDefinition extends Span {
636
628
  type: MethodDefinitionType;
637
- decorators: Array<Decorator>;
629
+ static: boolean;
630
+ computed: boolean;
638
631
  key: PropertyKey;
639
- value: Function;
640
632
  kind: MethodDefinitionKind;
641
- computed: boolean;
642
- static: boolean;
633
+ value: Function;
634
+ decorators: Array<Decorator>;
643
635
  override: boolean;
644
636
  optional: boolean;
645
637
  accessibility: TSAccessibility | null;
@@ -649,11 +641,11 @@ export type MethodDefinitionType = 'MethodDefinition' | 'TSAbstractMethodDefinit
649
641
 
650
642
  export interface PropertyDefinition extends Span {
651
643
  type: PropertyDefinitionType;
652
- decorators: Array<Decorator>;
644
+ static: boolean;
645
+ computed: boolean;
653
646
  key: PropertyKey;
654
647
  value: Expression | null;
655
- computed: boolean;
656
- static: boolean;
648
+ decorators: Array<Decorator>;
657
649
  declare: boolean;
658
650
  override: boolean;
659
651
  optional: boolean;
@@ -689,11 +681,11 @@ export type AccessorPropertyType = 'AccessorProperty' | 'TSAbstractAccessorPrope
689
681
 
690
682
  export interface AccessorProperty extends Span {
691
683
  type: AccessorPropertyType;
692
- decorators: Array<Decorator>;
693
684
  key: PropertyKey;
694
685
  value: Expression | null;
695
686
  computed: boolean;
696
687
  static: boolean;
688
+ decorators: Array<Decorator>;
697
689
  definite: boolean;
698
690
  typeAnnotation: TSTypeAnnotation | null;
699
691
  accessibility: TSAccessibility | null;
@@ -735,12 +727,6 @@ export interface ImportNamespaceSpecifier extends Span {
735
727
  local: BindingIdentifier;
736
728
  }
737
729
 
738
- export interface WithClause extends Span {
739
- type: 'WithClause';
740
- attributesKeyword: IdentifierName;
741
- withEntries: Array<ImportAttribute>;
742
- }
743
-
744
730
  export interface ImportAttribute extends Span {
745
731
  type: 'ImportAttribute';
746
732
  key: ImportAttributeKey;
@@ -809,16 +795,16 @@ export interface StringLiteral extends Span {
809
795
 
810
796
  export interface BigIntLiteral extends Span {
811
797
  type: 'Literal';
798
+ value: BigInt;
812
799
  raw: string | null;
813
- value: null;
814
800
  bigint: string;
815
801
  }
816
802
 
817
803
  export interface RegExpLiteral extends Span {
818
804
  type: 'Literal';
819
- regex: RegExp;
805
+ value: RegExp | null;
820
806
  raw: string | null;
821
- value: null;
807
+ regex: RegExp;
822
808
  }
823
809
 
824
810
  export interface RegExp {
@@ -955,10 +941,8 @@ export interface TSLiteralType extends Span {
955
941
 
956
942
  export type TSLiteral =
957
943
  | BooleanLiteral
958
- | NullLiteral
959
944
  | NumericLiteral
960
945
  | BigIntLiteral
961
- | RegExpLiteral
962
946
  | StringLiteral
963
947
  | TemplateLiteral
964
948
  | UnaryExpression;
@@ -988,7 +972,6 @@ export type TSType =
988
972
  | TSLiteralType
989
973
  | TSMappedType
990
974
  | TSNamedTupleMember
991
- | TSQualifiedName
992
975
  | TSTemplateLiteralType
993
976
  | TSThisType
994
977
  | TSTupleType