Commit Graph

106 Commits (e281f36ee46c0579ed68b8aaaecfa49936f73d7c)

Author SHA1 Message Date
Amaan Qureshi e281f36ee4
feat: add readonly to reserved identifiers 2024-01-31 21:02:02 +07:00
Amaan Qureshi 1da16a789c
chore: update javascript grammar 2024-01-31 20:58:02 +07:00
Amaan Qureshi 80d92e6900 chore: add and apply eslint formatting 2024-01-31 10:39:38 +07:00
Amaan Qureshi e1320febcc feat: allow an override modifier in abstract method signatures 2024-01-31 10:39:38 +07:00
Amaan Qureshi b5f38c773c feat: allow new as a reserved keyword 2024-01-31 10:39:38 +07:00
Amaan Qureshi 9639934418 chore: allow semis anywhere in class bodies 2024-01-31 10:39:38 +07:00
Amaan Qureshi d59b29d600 chore: tidying 2024-01-31 10:39:38 +07:00
Amaan Qureshi d63fbd4be8 chore: allow import in call expressions like js 2024-01-31 10:39:38 +07:00
Amaan Qureshi 8106351fbf fix: allow type queries in type annotations and type arguments in
special scenarios
2024-01-31 10:39:38 +07:00
Amaan Qureshi afd733999d chore: formatting 2024-01-31 10:39:38 +07:00
Amaan Qureshi 07f4633ea7 fix: allow `const` as a primary type 2024-01-31 10:39:38 +07:00
Amaan Qureshi 80a8a7d387 feat: support `using` 2024-01-31 10:39:38 +07:00
Amaan Qureshi ee9b195011 fix: `declare` can be before or after accessbility modifiers 2024-01-31 10:39:38 +07:00
Amaan Qureshi bb252d7481 fix: allow certain type queries in type annotations 2024-01-31 10:39:38 +07:00
Amaan Qureshi 9e0ce8e82e fix: move decorators inside public field definitions 2024-01-31 10:39:38 +07:00
Amaan Qureshi 40ddc0d5ce fix: allow object as a reserved identifier 2024-01-31 10:39:38 +07:00
Amaan Qureshi 90ebdcdb2e fix: javascript uses || now 2024-01-31 10:39:38 +07:00
Amaan Qureshi d6ff2db347 fix: plus signs in certain contexts were missing 2024-01-31 10:39:38 +07:00
Amaan Qureshi de7b843796 chore: remove unnecessary conflicts 2024-01-31 10:39:38 +07:00
Guillaume Brunerie 58c8f46990 Add support for instantiation expressions 2023-07-18 12:11:43 +07:00
HerringtonDarkholme bf4331c913
fix: fix conditional type parsing association
fix #231
2023-07-14 20:28:00 +07:00
Guillaume Brunerie 6cb04ce04d Add support for extends clauses in infer 2023-07-12 20:42:48 +07:00
Guillaume Brunerie ff072b843d Add support for const type parameters 2023-07-12 20:03:31 +07:00
Guillaume Brunerie bf216b8254 Add support for asserts in type declarations 2023-07-12 19:54:19 +07:00
Guillaume Brunerie 3ca110e747 Properly parse 'as const' 2023-07-12 19:54:09 +07:00
Guillaume Brunerie 2faf005d6f Add support for 'unique symbol' type 2023-07-12 19:53:54 +07:00
Amaan Qureshi af492b7ac4
fix: add alias for nested_identifiers from javascript grammar
This will keep query compatibility
2023-07-12 08:53:57 +07:00
Guillaume Brunerie b893426b82 fixes for JSX 2023-07-11 23:34:40 +07:00
Andrew Hlynskyi d6cbc7c03c fix: remove invalid `_enum_member` from inlines 2023-04-21 01:13:09 +07:00
Ryan Tsao 45ea26bfae Refactor alias as _import_identifier 2023-03-09 09:45:58 +07:00
Ryan Tsao c60846c5af Add more test cases 2023-03-08 10:20:30 +07:00
Ryan Tsao e127694f83 Fix edge cases with type imports 2023-03-02 13:25:34 +07:00
Raymond Ha e5a4cd4474
Update tree-sitter-javascript 2022-12-02 12:23:57 +07:00
Raymond Ha 163b395bf3
Create new satisfies_expression rule 2022-11-24 06:59:55 +07:00
Raymond Ha fe0763f9bb
Support satisfies operator 2022-11-23 18:00:09 +07:00
pad 46e9c43848 Merge branch 'master' into object_is 2022-06-24 13:13:28 +07:00
pad 3e83446ec2 Support predefined types in type predicates
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).
2022-06-23 14:26:27 +07:00
Nat Mote 0a90858cc7
Fix type_query precedence
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.
2022-06-21 19:03:39 +07:00
resolritter 1b3ba31c75
Fix extends (#204)
* support extends (abstract)

* regenerate parser

Co-authored-by: resolritter <resolritter@users.noreply.github.com>
2022-06-02 09:10:56 +07:00
Wsevolod 8e9dba7bd7
Handle `from_clause` in `export type` statement (#208) 2022-04-13 09:44:02 +07:00
R. E. Solritter e8e8e8dc27
document why module block is optional (#205)
Co-authored-by: resolritter <resolritter@users.noreply.github.com>
2022-01-10 13:42:45 +07:00
resolritter 360252fe21 use export_statement when exporting expressions 2022-01-08 03:23:15 +07:00
kraftwerk28 d863bcbce0 Remove intersection/union types from `_type` 2022-01-04 20:30:46 +07:00
kraftwerk28 dfaf3d1468 Add intersection/union types to `_primary_type` 2021-12-26 22:03:42 +07:00
Paul M. Rodriguez 4cf6a2c066 Update to fdeb68a and resolve conflicts 2021-10-21 09:42:26 +07:00
Paul M. Rodriguez 42a5efb09d Update tree-sitter-javascript to 2cc5803 2021-10-19 14:43:45 +07:00
IWANABETHATGUY a4b1bb6d45 fix: 🐛 template-literal-type with infer type 2021-10-10 02:39:12 +07:00
Hendrik van Antwerpen d9c8be8e52
Improve grammar for query writing (#187)
* 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.
2021-10-07 09:10:11 +07:00
Ronnie Magatti aa8a32821e
Define a precedence instead of conflict 2021-09-16 14:52:57 +07:00
Ronnie Magatti e4b669845a
Merge from master 2021-09-16 14:30:24 +07:00