Open socjalis opened 2 years ago
Please update the types.
Code contributions are welcome here 🙂 The jsonata.d.ts
TypeScript file was an outside contribution, and I don't have much familiarity with it - not sure if @andrew-coleman does either. I'd like to get around to looking at it at some point soon, but this would certainly get addressed quicker if anyone who does understand can provide a PR.
Hi, @mattbaileyuk, I can help with this. Before I make changes, do we know that lhs
returns ExprNode array always or are there exceptions? @socjalis can you confirm? Thanks!
@dkaushik95 Thanks, and yes, I believe it should always be an array, including an empty one.
According to the included types
lhs
inExprNode
should be of typeExprNode
itself. Meanwhile:resolves to:
As you can see, lhs is an array here. Incorrect types make it really hard to traverse the whole
expression.ast()
tree without checking 2k+ lines source code files, which makes the developer experience not that fun.Also I didn't really go that deep into the source code, but something like this seems more intuitive at the first glance and is coherent with the provided types: