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

Update AST for TSModuleDeclaration #371

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

Update AST for TSModuleDeclaration #371

JamesHenry opened this issue Aug 20, 2017 · 0 comments

Comments

@JamesHenry
Copy link
Member

Currently, we do not explicitly handle the transformation of SyntaxKind.ModuleDeclaration.

As per discussions with Andy, we want to move more towards modifiers being applied as booleans on the node, rather than persisting the array of modifiers (where possible).

Because we are falling back with deeplyCopy(), we are also currently persisting name from the original TSNode, whereas we should be using id.

E.g. the refactored AST diff would be something like:

-      "modifiers": Array [
-        Object {
-          "loc": Object {
-            "end": Object {
-              "column": 7,
-              "line": 1,
-            },
-            "start": Object {
-              "column": 0,
-              "line": 1,
-            },
-          },
-          "range": Array [
-            0,
-            7,
-          ],
-          "type": "TSDeclareKeyword",
-        },
-      ],
+      "declare": true,
-      "name": Object {
+      "id": Object {

I do not believe this change will have a negative impact on linting capabilities, and downstream dependencies can easily be updated to check for the boolean.

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

2 participants