Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

ESTree plugin not able to convert StringLiteral in TS shorthand module dec #683

Closed
JamesHenry opened this issue Aug 20, 2017 · 3 comments
Closed

Comments

@JamesHenry
Copy link
Member

When using the TypeScript and ESTree plugins together, the id of the TypeScript shorthand module declaration source below is coming through as a StringLiteral, instead of a Literal.

Input Code

declare module "hot-new-module";

Babylon/Babel Configuration

{
  "sourceType": "module",
  "plugins": ["typescript", "estree"]
}

Expected Behavior

Current (red) vs Expected (green) Behavior

{
  "type": "File",
  "start": 0,
  "end": 32,
  "loc": {
    "start": {
      "line": 1,
      "column": 0
    },
    "end": {
      "line": 1,
      "column": 32
    }
  },
  "program": {
    "type": "Program",
    "start": 0,
    "end": 32,
    "loc": {
      "start": {
        "line": 1,
        "column": 0
      },
      "end": {
        "line": 1,
        "column": 32
      }
    },
    "sourceType": "module",
    "body": [
      {
        "type": "TSModuleDeclaration",
        "start": 0,
        "end": 32,
        "loc": {
          "start": {
            "line": 1,
            "column": 0
          },
          "end": {
            "line": 1,
            "column": 32
          }
        },
        "id": {
-        "type": "StringLiteral",
+        "type": "Literal",
          "start": 15,
          "end": 31,
          "loc": {
            "start": {
              "line": 1,
              "column": 15
            },
            "end": {
              "line": 1,
              "column": 31
            }
          },
          "value": "hot-new-module",
          "raw": "\"hot-new-module\""
        },
        "declare": true
      }
    ]
  }
}
@hzoo
Copy link
Member

hzoo commented Aug 20, 2017

Hey @JamesHenry! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@JamesHenry
Copy link
Member Author

I have a fix ready for this

@existentialism
Copy link
Member

Fixed by #684, thanks @JamesHenry!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants