@willbooster/tree-sitter-typescript 1.3.1 → 1.3.3

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.
@@ -145,6 +145,9 @@ module.exports = function defineGrammar(dialect) {
145
145
  ],
146
146
 
147
147
  conflicts: ($, previous) => [
148
+ [$.export_specifier, $._local_export_specifier, $._module_export_name],
149
+ [$.export_specifier, $._module_export_name],
150
+ [$.export_specifier, $._local_export_specifier],
148
151
  ...withTypeArgumentsTarget($, previous),
149
152
  [$._type_arguments_target, $.using_declaration],
150
153
  [$._type_arguments_target, $._for_header, $._for_using_declaration],
@@ -475,9 +478,21 @@ module.exports = function defineGrammar(dialect) {
475
478
  // tsx only. See jsx_opening_element.
476
479
  jsx_self_closing_element: ($) => prec.dynamic(-1, seq($._jsx_start_opening_element, '/>')),
477
480
 
478
- export_specifier: (_, previous) => seq(optional(choice('type', 'typeof')), previous),
481
+ export_specifier: ($) => {
482
+ const name = choice($._module_export_name, alias('as', $.identifier));
483
+ const specifier = seq(field('name', name), optional(seq('as', field('alias', name))));
484
+ return choice(specifier, prec.dynamic(1, seq(choice('type', 'typeof'), specifier)));
485
+ },
479
486
 
480
- _local_export_specifier: (_, previous) => seq(optional(choice('type', 'typeof')), previous),
487
+ _module_export_name: ($, previous) => choice(previous, alias('type', $.identifier)),
488
+
489
+ _local_export_specifier: ($) => {
490
+ const specifier = seq(
491
+ field('name', choice($.identifier, alias('type', $.identifier), alias('as', $.identifier), $.string)),
492
+ optional(seq('as', field('alias', choice($._module_export_name, alias('as', $.identifier)))))
493
+ );
494
+ return choice(specifier, prec.dynamic(1, seq(choice('type', 'typeof'), specifier)));
495
+ },
481
496
 
482
497
  _import_identifier: ($) => choice($.identifier, alias('type', $.identifier)),
483
498
 
@@ -486,11 +501,7 @@ module.exports = function defineGrammar(dialect) {
486
501
  optional(choice('type', 'typeof')),
487
502
  choice(
488
503
  field('name', $._import_identifier),
489
- seq(
490
- field('name', choice($._module_export_name, alias('type', $.identifier))),
491
- 'as',
492
- field('alias', $._import_identifier)
493
- )
504
+ seq(field('name', $._module_export_name), 'as', field('alias', $._import_identifier))
494
505
  )
495
506
  ),
496
507
 
@@ -939,16 +950,7 @@ module.exports = function defineGrammar(dialect) {
939
950
 
940
951
  asserts_annotation: ($) => seq(seq(':', $.asserts)),
941
952
 
942
- type: ($) =>
943
- choice(
944
- $.primary_type,
945
- $.function_type,
946
- $.readonly_type,
947
- $.constructor_type,
948
- $.infer_type,
949
- prec(-1, alias($._type_query_member_expression_in_type_annotation, $.member_expression)),
950
- prec(-1, alias($._type_query_call_expression_in_type_annotation, $.call_expression))
951
- ),
953
+ type: ($) => choice($.primary_type, $.function_type, $.readonly_type, $.constructor_type, $.infer_type),
952
954
 
953
955
  tuple_parameter: ($) =>
954
956
  seq(
@@ -1028,6 +1030,8 @@ module.exports = function defineGrammar(dialect) {
1028
1030
  $.flow_maybe_type,
1029
1031
  $.type_query,
1030
1032
  $.index_type_query,
1033
+ prec(-1, alias($._type_query_member_expression_in_type_annotation, $.member_expression)),
1034
+ prec(-1, alias($._type_query_call_expression_in_type_annotation, $.call_expression)),
1031
1035
  alias($.this, $.this_type),
1032
1036
  $.existential_type,
1033
1037
  $.literal_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-typescript",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "TypeScript and TSX grammars for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -83,7 +83,7 @@
83
83
  }
84
84
  ],
85
85
  "metadata": {
86
- "version": "1.3.1",
86
+ "version": "1.3.3",
87
87
  "license": "MIT",
88
88
  "description": "TypeScript and TSX grammars for tree-sitter",
89
89
  "authors": [
@@ -283,6 +283,10 @@
283
283
  "type": "array_type",
284
284
  "named": true
285
285
  },
286
+ {
287
+ "type": "call_expression",
288
+ "named": true
289
+ },
286
290
  {
287
291
  "type": "conditional_type",
288
292
  "named": true
@@ -319,6 +323,10 @@
319
323
  "type": "lookup_type",
320
324
  "named": true
321
325
  },
326
+ {
327
+ "type": "member_expression",
328
+ "named": true
329
+ },
322
330
  {
323
331
  "type": "nested_type_identifier",
324
332
  "named": true
@@ -455,10 +463,6 @@
455
463
  "type": "type",
456
464
  "named": true,
457
465
  "subtypes": [
458
- {
459
- "type": "call_expression",
460
- "named": true
461
- },
462
466
  {
463
467
  "type": "constructor_type",
464
468
  "named": true
@@ -471,10 +475,6 @@
471
475
  "type": "infer_type",
472
476
  "named": true
473
477
  },
474
- {
475
- "type": "member_expression",
476
- "named": true
477
- },
478
478
  {
479
479
  "type": "primary_type",
480
480
  "named": true
@@ -279,6 +279,10 @@
279
279
  "type": "array_type",
280
280
  "named": true
281
281
  },
282
+ {
283
+ "type": "call_expression",
284
+ "named": true
285
+ },
282
286
  {
283
287
  "type": "conditional_type",
284
288
  "named": true
@@ -315,6 +319,10 @@
315
319
  "type": "lookup_type",
316
320
  "named": true
317
321
  },
322
+ {
323
+ "type": "member_expression",
324
+ "named": true
325
+ },
318
326
  {
319
327
  "type": "nested_type_identifier",
320
328
  "named": true
@@ -451,10 +459,6 @@
451
459
  "type": "type",
452
460
  "named": true,
453
461
  "subtypes": [
454
- {
455
- "type": "call_expression",
456
- "named": true
457
- },
458
462
  {
459
463
  "type": "constructor_type",
460
464
  "named": true
@@ -467,10 +471,6 @@
467
471
  "type": "infer_type",
468
472
  "named": true
469
473
  },
470
- {
471
- "type": "member_expression",
472
- "named": true
473
- },
474
474
  {
475
475
  "type": "primary_type",
476
476
  "named": true