typeof generic_type is not valid TypeScript syntax and does not make sense.
Using primary_expression causes the parsing errors described in https://github.com/tree-sitter/tree-sitter-typescript/issues/171. I found that it's possible to work around that by defining stricter variants of call_expression, subscript_expression and member_expression according to what I tried in the TypeScript playground. This is more restrictive than allowing all primary expressions like done right now, but it seems to work, so I'm submitting the PR here in case it's useful.
Initial measurements of parser.c against 74a2748896434c13cac7697c4d182b43ec170d30
type_query
is right now defined as follows:https://github.com/tree-sitter/tree-sitter-typescript/blob/74a2748896434c13cac7697c4d182b43ec170d30/common/define-grammar.js#L660
typeof generic_type
is not valid TypeScript syntax and does not make sense.Using
primary_expression
causes the parsing errors described in https://github.com/tree-sitter/tree-sitter-typescript/issues/171. I found that it's possible to work around that by defining stricter variants ofcall_expression
,subscript_expression
andmember_expression
according to what I tried in the TypeScript playground. This is more restrictive than allowing all primary expressions like done right now, but it seems to work, so I'm submitting the PR here in case it's useful.Initial measurements of
parser.c
against 74a2748896434c13cac7697c4d182b43ec170d30./typescript/src/parser.c
./tsx/src/parser.c
Checklist:
closes https://github.com/tree-sitter/tree-sitter-typescript/issues/171