@@ -10,6 +10,7 @@ module.exports = function defineGrammar(dialect) {
1010 ] ) ,
1111
1212 supertypes : ( $ , previous ) => previous . concat ( [
13+ $ . type ,
1314 $ . primary_type ,
1415 ] ) ,
1516
@@ -42,13 +43,13 @@ module.exports = function defineGrammar(dialect) {
4243 [ 'unary' , 'assign' ] ,
4344 [ 'declaration' , $ . expression ] ,
4445 [ $ . predefined_type , $ . unary_expression ] ,
45- [ $ . _type , $ . flow_maybe_type ] ,
46- [ $ . tuple_type , $ . array_type , $ . pattern , $ . _type ] ,
46+ [ $ . type , $ . flow_maybe_type ] ,
47+ [ $ . tuple_type , $ . array_type , $ . pattern , $ . type ] ,
4748 [ $ . readonly_type , $ . pattern ] ,
4849 [ $ . readonly_type , $ . primary_expression ] ,
4950 [ $ . type_query , $ . subscript_expression , $ . expression ] ,
5051 [ $ . type_query , $ . _type_query_subscript_expression ] ,
51- [ $ . nested_type_identifier , $ . generic_type , $ . primary_type , $ . lookup_type , $ . index_type_query , $ . _type ] ,
52+ [ $ . nested_type_identifier , $ . generic_type , $ . primary_type , $ . lookup_type , $ . index_type_query , $ . type ] ,
5253 [ $ . as_expression , $ . satisfies_expression , $ . primary_type ] ,
5354 [ $ . _type_query_member_expression , $ . member_expression ] ,
5455 [ $ . member_expression , $ . _type_query_member_expression_in_type_annotation ] ,
@@ -457,13 +458,13 @@ module.exports = function defineGrammar(dialect) {
457458 as_expression : $ => prec . left ( 'binary' , seq (
458459 $ . expression ,
459460 'as' ,
460- choice ( 'const' , $ . _type ) ,
461+ choice ( 'const' , $ . type ) ,
461462 ) ) ,
462463
463464 satisfies_expression : $ => prec . left ( 'binary' , seq (
464465 $ . expression ,
465466 'satisfies' ,
466- $ . _type ,
467+ $ . type ,
467468 ) ) ,
468469
469470 instantiation_expression : $ => prec ( 'instantiation' , seq (
@@ -497,15 +498,15 @@ module.exports = function defineGrammar(dialect) {
497498
498499 implements_clause : $ => seq (
499500 'implements' ,
500- commaSep1 ( $ . _type ) ,
501+ commaSep1 ( $ . type ) ,
501502 ) ,
502503
503504 ambient_declaration : $ => seq (
504505 'declare' ,
505506 choice (
506507 $ . declaration ,
507508 seq ( 'global' , $ . statement_block ) ,
508- seq ( 'module' , '.' , alias ( $ . identifier , $ . property_identifier ) , ':' , $ . _type , $ . _semicolon ) ,
509+ seq ( 'module' , '.' , alias ( $ . identifier , $ . property_identifier ) , ':' , $ . type , $ . _semicolon ) ,
509510 ) ,
510511 ) ,
511512
@@ -615,7 +616,7 @@ module.exports = function defineGrammar(dialect) {
615616 field ( 'name' , $ . _type_identifier ) ,
616617 field ( 'type_parameters' , optional ( $ . type_parameters ) ) ,
617618 '=' ,
618- field ( 'value' , $ . _type ) ,
619+ field ( 'value' , $ . type ) ,
619620 $ . _semicolon ,
620621 ) ,
621622
@@ -648,13 +649,13 @@ module.exports = function defineGrammar(dialect) {
648649 field ( 'pattern' , choice ( $ . pattern , $ . this ) ) ,
649650 ) ,
650651
651- omitting_type_annotation : $ => seq ( '-?:' , $ . _type ) ,
652- adding_type_annotation : $ => seq ( '+?:' , $ . _type ) ,
653- opting_type_annotation : $ => seq ( '?:' , $ . _type ) ,
652+ omitting_type_annotation : $ => seq ( '-?:' , $ . type ) ,
653+ adding_type_annotation : $ => seq ( '+?:' , $ . type ) ,
654+ opting_type_annotation : $ => seq ( '?:' , $ . type ) ,
654655 type_annotation : $ => seq (
655656 ':' ,
656657 choice (
657- $ . _type ,
658+ $ . type ,
658659 alias ( $ . _type_query_member_expression_in_type_annotation , $ . member_expression ) ,
659660 alias ( $ . _type_query_call_expression_in_type_annotation , $ . call_expression ) ,
660661 ) ,
@@ -695,7 +696,7 @@ module.exports = function defineGrammar(dialect) {
695696 seq ( ':' , $ . asserts ) ,
696697 ) ,
697698
698- _type : $ => choice (
699+ type : $ => choice (
699700 $ . primary_type ,
700701 $ . function_type ,
701702 $ . readonly_type ,
@@ -714,15 +715,15 @@ module.exports = function defineGrammar(dialect) {
714715 field ( 'type' , $ . type_annotation ) ,
715716 ) ,
716717
717- optional_type : $ => seq ( $ . _type , '?' ) ,
718- rest_type : $ => seq ( '...' , $ . _type ) ,
718+ optional_type : $ => seq ( $ . type , '?' ) ,
719+ rest_type : $ => seq ( '...' , $ . type ) ,
719720
720721 _tuple_type_member : $ => choice (
721722 alias ( $ . tuple_parameter , $ . required_parameter ) ,
722723 alias ( $ . optional_tuple_parameter , $ . optional_parameter ) ,
723724 $ . optional_type ,
724725 $ . rest_type ,
725- $ . _type ,
726+ $ . type ,
726727 ) ,
727728
728729 constructor_type : $ => prec . left ( seq (
@@ -731,7 +732,7 @@ module.exports = function defineGrammar(dialect) {
731732 field ( 'type_parameters' , optional ( $ . type_parameters ) ) ,
732733 field ( 'parameters' , $ . formal_parameters ) ,
733734 '=>' ,
734- field ( 'type' , $ . _type ) ,
735+ field ( 'type' , $ . type ) ,
735736 ) ) ,
736737
737738 primary_type : $ => choice (
@@ -773,18 +774,18 @@ module.exports = function defineGrammar(dialect) {
773774 $ . _type_identifier ,
774775 optional ( seq (
775776 'extends' ,
776- $ . _type ,
777+ $ . type ,
777778 ) ) ,
778779 ) ) ,
779780
780781 conditional_type : $ => prec . right ( seq (
781- field ( 'left' , $ . _type ) ,
782+ field ( 'left' , $ . type ) ,
782783 'extends' ,
783- field ( 'right' , $ . _type ) ,
784+ field ( 'right' , $ . type ) ,
784785 '?' ,
785- field ( 'consequence' , $ . _type ) ,
786+ field ( 'consequence' , $ . type ) ,
786787 ':' ,
787- field ( 'alternative' , $ . _type ) ,
788+ field ( 'alternative' , $ . type ) ,
788789 ) ) ,
789790
790791 generic_type : $ => prec ( 'call' , seq (
@@ -807,7 +808,7 @@ module.exports = function defineGrammar(dialect) {
807808 alias ( $ . predefined_type , $ . identifier ) ,
808809 ) ) ,
809810 'is' ,
810- field ( 'type' , $ . _type ) ,
811+ field ( 'type' , $ . type ) ,
811812 ) ,
812813
813814 type_predicate_annotation : $ => seq (
@@ -875,15 +876,15 @@ module.exports = function defineGrammar(dialect) {
875876 lookup_type : $ => seq (
876877 $ . primary_type ,
877878 '[' ,
878- $ . _type ,
879+ $ . type ,
879880 ']' ,
880881 ) ,
881882
882883 mapped_type_clause : $ => seq (
883884 field ( 'name' , $ . _type_identifier ) ,
884885 'in' ,
885- field ( 'type' , $ . _type ) ,
886- optional ( seq ( 'as' , field ( 'alias' , $ . _type ) ) ) ,
886+ field ( 'type' , $ . type ) ,
887+ optional ( seq ( 'as' , field ( 'alias' , $ . type ) ) ) ,
887888 ) ,
888889
889890 literal_type : $ => choice (
@@ -905,7 +906,7 @@ module.exports = function defineGrammar(dialect) {
905906
906907 flow_maybe_type : $ => prec . right ( seq ( '?' , $ . primary_type ) ) ,
907908
908- parenthesized_type : $ => seq ( '(' , $ . _type , ')' ) ,
909+ parenthesized_type : $ => seq ( '(' , $ . type , ')' ) ,
909910
910911 predefined_type : _ => choice (
911912 'any' ,
@@ -924,7 +925,7 @@ module.exports = function defineGrammar(dialect) {
924925 type_arguments : $ => seq (
925926 '<' ,
926927 commaSep1 ( choice (
927- $ . _type ,
928+ $ . type ,
928929 alias ( $ . _type_query_member_expression_in_type_annotation , $ . member_expression ) ,
929930 alias ( $ . _type_query_call_expression_in_type_annotation , $ . call_expression ) ,
930931 ) ) ,
@@ -985,12 +986,12 @@ module.exports = function defineGrammar(dialect) {
985986
986987 default_type : $ => seq (
987988 '=' ,
988- $ . _type ,
989+ $ . type ,
989990 ) ,
990991
991992 constraint : $ => seq (
992993 choice ( 'extends' , ':' ) ,
993- $ . _type ,
994+ $ . type ,
994995 ) ,
995996
996997 construct_signature : $ => seq (
@@ -1016,7 +1017,7 @@ module.exports = function defineGrammar(dialect) {
10161017 alias ( $ . _reserved_identifier , $ . identifier ) ,
10171018 ) ) ,
10181019 ':' ,
1019- field ( 'index_type' , $ . _type ) ,
1020+ field ( 'index_type' , $ . type ) ,
10201021 ) ,
10211022 $ . mapped_type_clause ,
10221023 ) ,
@@ -1033,16 +1034,16 @@ module.exports = function defineGrammar(dialect) {
10331034 tuple_type : $ => seq (
10341035 '[' , commaSep ( $ . _tuple_type_member ) , optional ( ',' ) , ']' ,
10351036 ) ,
1036- readonly_type : $ => seq ( 'readonly' , $ . _type ) ,
1037+ readonly_type : $ => seq ( 'readonly' , $ . type ) ,
10371038
1038- union_type : $ => prec . left ( seq ( optional ( $ . _type ) , '|' , $ . _type ) ) ,
1039- intersection_type : $ => prec . left ( seq ( optional ( $ . _type ) , '&' , $ . _type ) ) ,
1039+ union_type : $ => prec . left ( seq ( optional ( $ . type ) , '|' , $ . type ) ) ,
1040+ intersection_type : $ => prec . left ( seq ( optional ( $ . type ) , '&' , $ . type ) ) ,
10401041
10411042 function_type : $ => prec . left ( seq (
10421043 field ( 'type_parameters' , optional ( $ . type_parameters ) ) ,
10431044 field ( 'parameters' , $ . formal_parameters ) ,
10441045 '=>' ,
1045- field ( 'return_type' , choice ( $ . _type , $ . asserts , $ . type_predicate ) ) ,
1046+ field ( 'return_type' , choice ( $ . type , $ . asserts , $ . type_predicate ) ) ,
10461047 ) ) ,
10471048
10481049 _type_identifier : $ => alias ( $ . identifier , $ . type_identifier ) ,
0 commit comments