Skip to content

Commit f58ed70

Browse files
committed
fix: add type params to typealias
1 parent b953dbd commit f58ed70

File tree

6 files changed

+484918
-467765
lines changed

6 files changed

+484918
-467765
lines changed

grammar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ module.exports = grammar({
179179
optional($.modifiers),
180180
"typealias",
181181
alias($.simple_identifier, $.type_identifier),
182+
optional($.type_parameters),
182183
"=",
183184
$._type
184185
),
@@ -1188,7 +1189,7 @@ module.exports = grammar({
11881189
$._backtick_identifier,
11891190
),
11901191

1191-
_alpha_identifier: $ => /[a-zA-Z_][a-zA-Z_0-9]*/,
1192+
_alpha_identifier: $ => /[\p{L}_][\p{L}\p{Nd}_]*/,
11921193

11931194
_backtick_identifier: $ => /`[^\r\n`]+`/,
11941195

src/grammar.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,18 @@
267267
"named": true,
268268
"value": "type_identifier"
269269
},
270+
{
271+
"type": "CHOICE",
272+
"members": [
273+
{
274+
"type": "SYMBOL",
275+
"name": "type_parameters"
276+
},
277+
{
278+
"type": "BLANK"
279+
}
280+
]
281+
},
270282
{
271283
"type": "STRING",
272284
"value": "="
@@ -6065,7 +6077,7 @@
60656077
},
60666078
"_alpha_identifier": {
60676079
"type": "PATTERN",
6068-
"value": "[a-zA-Z_][a-zA-Z_0-9]*"
6080+
"value": "[\\p{L}_][\\p{L}\\p{Nd}_]*"
60696081
},
60706082
"_backtick_identifier": {
60716083
"type": "PATTERN",

src/node-types.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8289,6 +8289,10 @@
82898289
"type": "type_modifiers",
82908290
"named": true
82918291
},
8292+
{
8293+
"type": "type_parameters",
8294+
"named": true
8295+
},
82928296
{
82938297
"type": "user_type",
82948298
"named": true

0 commit comments

Comments
 (0)