-
-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Labels
bugpriority:mediummedium-priority task, typically with broad demand but not blockingmedium-priority task, typically with broad demand but not blocking
Description
- The following piece of code is valid but it is parsed incorrectly:
const { hooks: { hashPassword } = {} } = {}- Here's a link to the TypeScript Playground showing that the snippet above is valid JavaScript or TypeScript:
https://www.typescriptlang.org/play?#code/MYewdgzgLgBA3jAFiEBrCAueSCGFEAKeEA7iAE4AmMAvjALzx12Nw0BQQA
The code does not pass the Typescript type checking
- The output of
tree-sitter parseis the following:
tree-sitter parse ./code.js
(program [0, 0] - [1, 0]
(lexical_declaration [0, 0] - [0, 36]
(variable_declarator [0, 6] - [0, 36]
name: (object_pattern [0, 6] - [0, 31]
(pair_pattern [0, 8] - [0, 31]
key: (property_identifier [0, 8] - [0, 13])
value: (object_pattern [0, 15] - [0, 31]
(shorthand_property_identifier_pattern [0, 17] - [0, 29]))))
value: (object [0, 34] - [0, 36])))
(ERROR [0, 37] - [0, 40])
(statement_block [0, 41] - [0, 43]))
./code.js 0 ms (MISSING "}" [0, 31] - [0, 31])
- Notes
With grammar 0.16.0, used to work fine.
- Minimal reproducible example
https://github.com/sguillia/tree-sitter-javascript-regression
Metadata
Metadata
Assignees
Labels
bugpriority:mediummedium-priority task, typically with broad demand but not blockingmedium-priority task, typically with broad demand but not blocking