Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Type in Interface ExprNode, lhs can be both an ExprNode and ExprNode[] #703

Open
DevDimov opened this issue Jun 26, 2024 · 0 comments

Comments

@DevDimov
Copy link

DevDimov commented Jun 26, 2024

In Interface ExprNode, lhs can be both an ExprNode and ExprNode[]

For example, jsonata('($x := 1; $y := 2;)').ast().expressions outputs

[
  {
    type: "bind",
    value: ":=",
    position: 7,
    lhs: { value: "x", type: "variable", position: 4 },
    rhs: { value: 1, type: "number", position: 9 },
  },
  {
    type: "bind",
    value: ":=",
    position: 15,
    lhs: { value: "y", type: "variable", position: 13 },
    rhs: { value: 2, type: "number", position: 16 },
  },
];

And jsonata('{"x": y, "z": 1}').ast() outputs

{
      "type": "unary",
      "value": "{",
      "position": 1,
      "lhs": [
        [
          {
            "value": "x",
            "type": "string",
            "position": 4
          },
          {
            "type": "path",
            "steps": [
              {
                "value": "y",
                "type": "name",
                "position": 7
              }
            ]
          }
        ],
        [
          {
            "value": "z",
            "type": "string",
            "position": 12
          },
          {
            "value": 1,
            "type": "number",
            "position": 15
          }
        ]
      ]
    }

Similar issue: #585

I'm using node v20.13.0 and jsonata v2.0.4. Happy to open a pull request.

DevDimov added a commit to DevDimov/jsonata that referenced this issue Jul 4, 2024
Update interface property ExprNode.lhs to be either an ExprNode or ExprNode[] as described in issue jsonata-js#703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant