@oxc-project/types 0.59.0 → 0.61.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 +54 -64
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-project/types",
3
- "version": "0.59.0",
3
+ "version": "0.61.0",
4
4
  "description": "Types for Oxc AST nodes",
5
5
  "keywords": [
6
6
  "AST",
package/types.d.ts CHANGED
@@ -54,11 +54,17 @@ export type Expression =
54
54
  export interface IdentifierName extends Span {
55
55
  type: 'Identifier';
56
56
  name: string;
57
+ decorators?: [];
58
+ optional?: false;
59
+ typeAnnotation?: null;
57
60
  }
58
61
 
59
62
  export interface IdentifierReference extends Span {
60
63
  type: 'Identifier';
61
64
  name: string;
65
+ decorators?: [];
66
+ optional?: false;
67
+ typeAnnotation?: null;
62
68
  }
63
69
 
64
70
  export interface BindingIdentifier extends Span {
@@ -113,7 +119,7 @@ export interface TaggedTemplateExpression extends Span {
113
119
  type: 'TaggedTemplateExpression';
114
120
  tag: Expression;
115
121
  quasi: TemplateLiteral;
116
- typeArguments: TSTypeParameterInstantiation | null;
122
+ typeArguments?: TSTypeParameterInstantiation | null;
117
123
  }
118
124
 
119
125
  export interface TemplateElement extends Span {
@@ -158,14 +164,14 @@ export interface CallExpression extends Span {
158
164
  callee: Expression;
159
165
  arguments: Array<Argument>;
160
166
  optional: boolean;
161
- typeArguments: TSTypeParameterInstantiation | null;
167
+ typeArguments?: TSTypeParameterInstantiation | null;
162
168
  }
163
169
 
164
170
  export interface NewExpression extends Span {
165
171
  type: 'NewExpression';
166
172
  callee: Expression;
167
173
  arguments: Array<Argument>;
168
- typeArguments: TSTypeParameterInstantiation | null;
174
+ typeArguments?: TSTypeParameterInstantiation | null;
169
175
  }
170
176
 
171
177
  export interface MetaProperty extends Span {
@@ -365,16 +371,16 @@ export interface VariableDeclaration extends Span {
365
371
  type: 'VariableDeclaration';
366
372
  declarations: Array<VariableDeclarator>;
367
373
  kind: VariableDeclarationKind;
368
- declare: boolean;
374
+ declare?: boolean;
369
375
  }
370
376
 
371
- export type VariableDeclarationKind = 'var' | 'const' | 'let' | 'using' | 'await using';
377
+ export type VariableDeclarationKind = 'var' | 'let' | 'const' | 'using' | 'await using';
372
378
 
373
379
  export interface VariableDeclarator extends Span {
374
380
  type: 'VariableDeclarator';
375
381
  id: BindingPattern;
376
382
  init: Expression | null;
377
- definite: boolean;
383
+ definite?: boolean;
378
384
  }
379
385
 
380
386
  export interface EmptyStatement extends Span {
@@ -384,7 +390,7 @@ export interface EmptyStatement extends Span {
384
390
  export interface ExpressionStatement extends Span {
385
391
  type: 'ExpressionStatement';
386
392
  expression: Expression;
387
- directive: string | null;
393
+ directive?: string | null;
388
394
  }
389
395
 
390
396
  export interface IfStatement extends Span {
@@ -496,8 +502,8 @@ export interface DebuggerStatement extends Span {
496
502
 
497
503
  export type BindingPattern =
498
504
  & ({
499
- typeAnnotation: TSTypeAnnotation | null;
500
- optional: boolean;
505
+ typeAnnotation?: TSTypeAnnotation | null;
506
+ optional?: boolean;
501
507
  })
502
508
  & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern);
503
509
 
@@ -542,10 +548,10 @@ export interface Function extends Span {
542
548
  async: boolean;
543
549
  params: ParamPattern[];
544
550
  body: FunctionBody | null;
545
- declare: boolean;
546
- typeParameters: TSTypeParameterDeclaration | null;
547
- thisParam: TSThisParameter | null;
548
- returnType: TSTypeAnnotation | null;
551
+ declare?: boolean;
552
+ typeParameters?: TSTypeParameterDeclaration | null;
553
+ thisParam?: TSThisParameter | null;
554
+ returnType?: TSTypeAnnotation | null;
549
555
  }
550
556
 
551
557
  export type ParamPattern = FormalParameter | FormalParameterRest;
@@ -565,10 +571,10 @@ export interface FormalParameterRest extends Span {
565
571
 
566
572
  export type FormalParameter =
567
573
  & ({
568
- decorators: Array<Decorator>;
569
- accessibility: TSAccessibility | null;
570
- readonly: boolean;
571
- override: boolean;
574
+ decorators?: Array<Decorator>;
575
+ accessibility?: TSAccessibility | null;
576
+ readonly?: boolean;
577
+ override?: boolean;
572
578
  })
573
579
  & BindingPattern;
574
580
 
@@ -585,8 +591,8 @@ export interface ArrowFunctionExpression extends Span {
585
591
  async: boolean;
586
592
  params: ParamPattern[];
587
593
  body: FunctionBody | Expression;
588
- typeParameters: TSTypeParameterDeclaration | null;
589
- returnType: TSTypeAnnotation | null;
594
+ typeParameters?: TSTypeParameterDeclaration | null;
595
+ returnType?: TSTypeAnnotation | null;
590
596
  }
591
597
 
592
598
  export interface YieldExpression extends Span {
@@ -600,12 +606,12 @@ export interface Class extends Span {
600
606
  id: BindingIdentifier | null;
601
607
  superClass: Expression | null;
602
608
  body: ClassBody;
603
- decorators: Array<Decorator>;
604
- typeParameters: TSTypeParameterDeclaration | null;
605
- superTypeArguments: TSTypeParameterInstantiation | null;
606
- implements: Array<TSClassImplements>;
607
- abstract: boolean;
608
- declare: boolean;
609
+ decorators?: Array<Decorator>;
610
+ typeParameters?: TSTypeParameterDeclaration | null;
611
+ superTypeArguments?: TSTypeParameterInstantiation | null;
612
+ implements?: Array<TSClassImplements>;
613
+ abstract?: boolean;
614
+ declare?: boolean;
609
615
  }
610
616
 
611
617
  export type ClassType = 'ClassDeclaration' | 'ClassExpression';
@@ -624,10 +630,10 @@ export interface MethodDefinition extends Span {
624
630
  key: PropertyKey;
625
631
  kind: MethodDefinitionKind;
626
632
  value: Function;
627
- decorators: Array<Decorator>;
628
- override: boolean;
629
- optional: boolean;
630
- accessibility: TSAccessibility | null;
633
+ decorators?: Array<Decorator>;
634
+ override?: boolean;
635
+ optional?: boolean;
636
+ accessibility?: TSAccessibility | null;
631
637
  }
632
638
 
633
639
  export type MethodDefinitionType = 'MethodDefinition' | 'TSAbstractMethodDefinition';
@@ -638,14 +644,14 @@ export interface PropertyDefinition extends Span {
638
644
  computed: boolean;
639
645
  key: PropertyKey;
640
646
  value: Expression | null;
641
- decorators: Array<Decorator>;
642
- declare: boolean;
643
- override: boolean;
644
- optional: boolean;
645
- definite: boolean;
646
- readonly: boolean;
647
- typeAnnotation: TSTypeAnnotation | null;
648
- accessibility: TSAccessibility | null;
647
+ decorators?: Array<Decorator>;
648
+ declare?: boolean;
649
+ override?: boolean;
650
+ optional?: boolean;
651
+ definite?: boolean;
652
+ readonly?: boolean;
653
+ typeAnnotation?: TSTypeAnnotation | null;
654
+ accessibility?: TSAccessibility | null;
649
655
  }
650
656
 
651
657
  export type PropertyDefinitionType = 'PropertyDefinition' | 'TSAbstractPropertyDefinition';
@@ -678,10 +684,10 @@ export interface AccessorProperty extends Span {
678
684
  value: Expression | null;
679
685
  computed: boolean;
680
686
  static: boolean;
681
- decorators: Array<Decorator>;
682
- definite: boolean;
683
- typeAnnotation: TSTypeAnnotation | null;
684
- accessibility: TSAccessibility | null;
687
+ decorators?: Array<Decorator>;
688
+ definite?: boolean;
689
+ typeAnnotation?: TSTypeAnnotation | null;
690
+ accessibility?: TSAccessibility | null;
685
691
  }
686
692
 
687
693
  export interface ImportExpression extends Span {
@@ -695,7 +701,7 @@ export interface ImportDeclaration extends Span {
695
701
  specifiers: Array<ImportDeclarationSpecifier>;
696
702
  source: StringLiteral;
697
703
  attributes: Array<ImportAttribute>;
698
- importKind: ImportOrExportKind;
704
+ importKind?: ImportOrExportKind;
699
705
  }
700
706
 
701
707
  export type ImportPhase = 'source' | 'defer';
@@ -706,7 +712,7 @@ export interface ImportSpecifier extends Span {
706
712
  type: 'ImportSpecifier';
707
713
  imported: ModuleExportName;
708
714
  local: BindingIdentifier;
709
- importKind: ImportOrExportKind;
715
+ importKind?: ImportOrExportKind;
710
716
  }
711
717
 
712
718
  export interface ImportDefaultSpecifier extends Span {
@@ -733,7 +739,7 @@ export interface ExportNamedDeclaration extends Span {
733
739
  specifiers: Array<ExportSpecifier>;
734
740
  source: StringLiteral | null;
735
741
  attributes: Array<ImportAttribute>;
736
- exportKind: ImportOrExportKind;
742
+ exportKind?: ImportOrExportKind;
737
743
  }
738
744
 
739
745
  export interface ExportDefaultDeclaration extends Span {
@@ -746,14 +752,14 @@ export interface ExportAllDeclaration extends Span {
746
752
  exported: ModuleExportName | null;
747
753
  source: StringLiteral;
748
754
  attributes: Array<ImportAttribute>;
749
- exportKind: ImportOrExportKind;
755
+ exportKind?: ImportOrExportKind;
750
756
  }
751
757
 
752
758
  export interface ExportSpecifier extends Span {
753
759
  type: 'ExportSpecifier';
754
760
  local: ModuleExportName;
755
761
  exported: ModuleExportName;
756
- exportKind: ImportOrExportKind;
762
+ exportKind?: ImportOrExportKind;
757
763
  }
758
764
 
759
765
  export type ExportDefaultDeclarationKind = Function | Class | TSInterfaceDeclaration | Expression;
@@ -821,7 +827,7 @@ export interface JSXOpeningElement extends Span {
821
827
  attributes: Array<JSXAttributeItem>;
822
828
  name: JSXElementName;
823
829
  selfClosing: boolean;
824
- typeArguments: TSTypeParameterInstantiation | null;
830
+ typeArguments?: TSTypeParameterInstantiation | null;
825
831
  }
826
832
 
827
833
  export interface JSXClosingElement extends Span {
@@ -1286,26 +1292,12 @@ export type TSTypeQueryExprName = TSImportType | TSTypeName;
1286
1292
  export interface TSImportType extends Span {
1287
1293
  type: 'TSImportType';
1288
1294
  argument: TSType;
1289
- options: TSImportAttributes | null;
1295
+ options: ObjectExpression | null;
1290
1296
  qualifier: TSTypeName | null;
1291
1297
  typeArguments: TSTypeParameterInstantiation | null;
1292
1298
  isTypeOf: boolean;
1293
1299
  }
1294
1300
 
1295
- export interface TSImportAttributes extends Span {
1296
- type: 'TSImportAttributes';
1297
- attributesKeyword: IdentifierName;
1298
- elements: Array<TSImportAttribute>;
1299
- }
1300
-
1301
- export interface TSImportAttribute extends Span {
1302
- type: 'TSImportAttribute';
1303
- name: TSImportAttributeName;
1304
- value: Expression;
1305
- }
1306
-
1307
- export type TSImportAttributeName = IdentifierName | StringLiteral;
1308
-
1309
1301
  export interface TSFunctionType extends Span {
1310
1302
  type: 'TSFunctionType';
1311
1303
  typeParameters: TSTypeParameterDeclaration | null;
@@ -1793,8 +1785,6 @@ export type Node =
1793
1785
  | TSInferType
1794
1786
  | TSTypeQuery
1795
1787
  | TSImportType
1796
- | TSImportAttributes
1797
- | TSImportAttribute
1798
1788
  | TSFunctionType
1799
1789
  | TSConstructorType
1800
1790
  | TSMappedType