tree-sitter / tree-sitter-typescript

TypeScript grammar for tree-sitter
MIT License
332 stars 103 forks source link

Consider alias for interface declaration body? #269

Closed helixbass closed 5 months ago

helixbass commented 6 months ago

Hi, I just ran into the fact that (interface_declaration)'s body is an (object_type)

Basically it seems unexpected/inconvenient that then there's no (easy) way to target just "object type literals" eg in a tree-sitter query (since if you do a query for (object_type) it will also capture the {...} part of interface declarations, which conceptually seems like a very different thing than an object type literal)

So from my limited understanding of tree-sitter grammars maybe the easiest fix would be to alias the (interface_declaration) body field's node to some other name besides object_type (eg interface_declaration_body)?