Closed patrickt closed 5 months ago
Looks like the parser is recognising the object
part as predefined_type
before matching it as a required_parameter
. If you rename object
to something else like obj
it will start to work.
Looking at the TypeScript parser, it seems it is okay with using object
as a parameter name.
(btw, you probably don't want to use things like String
as a type in this context)
The following piece of code is valid but it is parsed incorrectly:
Here's a link to the TypeScript Playground showing that the snippet above is valid JavaScript or TypeScript: https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgURQRgE8B5MGBCJAZzgG8AoOVuaAEzQCESAuOAGUYUZAHM4AHzgAKGRABGAK2DYYAzEhIBKOAF4AfEJHipcTToDcTAL5A
The output of
tree-sitter parse
is the following:Removing the
object: any
type annotation fixes it.