In `function (): object {...}` object is a predefined type, but
in `function (object: any): object is foo{}` object is now
a regular identifier. The previous grammar was not able
to parse the second example, probably because when the parsers
sees the second ':' for the return type, the contextual lexual
does not know yet if it's a type predicate or predefined type, so
it accepts 'object' as a predefined type and only fail later when
it sees 'is'.
test plan:
I tried in astexplorer.net and the second example is valid typescript
code (sadly).
The precedence for `type_query` needs to be higher than that of
`_type_query_subscript_expression`. Otherwise, the parser will generate
incorrect parses, and even fail to parse valid code in some cases.
The code `type X1 = typeof Y[keyof typeof Z];` should actually have
`typeof Y` grouped together. I verified this in astexplorer.net, and I
verified that TypeScript itself does parse this line. Currently, it
fails to parse using this tree-sitter grammar. Because of the incorrect
precedence, it expects an expression between the brackets instead of a
type.
I also used AST Explorer to check how TypeScript parses the other tests
that changed. In both cases, the updated parse is correct.
* Alias this type.
* Separate class and interface extends clauses.
* Name fields of parameters.
* Name type parameters fields.
* Name parameters fields.
* Name import source fields.
* Name property name fields in enums.
* Name type in parenthesized expression.
* Name index signature fields.
* Name mapped type clause fields.
* Name type field in construct signature.
* Name type field in constructor type.
* Name fields in tuple parameters.
* Name fields in type parameters.
* Rename field to follow convention of other function return types.
* Name more fields in types.
* Use tree-sitter from local modules, instead of relying on globally available executable.
* Down-grade tree-sitter version used for Rust bindings for compatibility.
* Update lock file to current dependency.