Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Incorrect location for TypeParameterInstantiation with comments #316

Closed
@vjeux

Description

@vjeux

What version of typescript-eslint-parser are you using?

8062515

What code were you trying to parse?

functionName<A /* A comment */>();

What did you expect to happen?
To have the location be [12, 31]

What happened?

It is [12, 15]. This time I cannot even workaround because the inner value doesn't go outside of the container bounds.

{
  "type": "TypeParameterInstantiation",
  "range": [
    12, // <------------
    15
  ],
  "loc": {
    "start": {
      "line": 1,
      "column": 12
    },
    "end": {
      "line": 1,
      "column": 15
    }
  },
  "params": [
    {
      "type": "GenericTypeAnnotation",
      "range": [
        13, // <------------
        14
      ],
      "loc": {
        "start": {
          "line": 1,
          "column": 13
        },
        "end": {
          "line": 1,
          "column": 14
        }
      },
      "id": {
        "type": "Identifier",
        "range": [
          13, // <------------
          14
        ],
        "loc": {
          "start": {
            "line": 1,
            "column": 13
          },
          "end": {
            "line": 1,
            "column": 14
          }
        },
        "name": "A"
      },
      "typeParameters": null
    }
  ],
  "comments": [
    {
      "type": "Block",
      "value": " A comment ",
      "range": [
        15, // <------------
        30
      ],
      "loc": {
        "start": {
          "line": 1,
          "column": 15
        },
        "end": {
          "line": 1,
          "column": 30
        }
      },
      "leading": false,
      "trailing": true,
      "printed": false
    }
  ]
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions