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

Flags seems to be off for factory.createVariableDeclarationList #132

Open
EloB opened this issue Jan 19, 2024 · 0 comments
Open

Flags seems to be off for factory.createVariableDeclarationList #132

EloB opened this issue Jan 19, 2024 · 0 comments

Comments

@EloB
Copy link

EloB commented Jan 19, 2024

First things first! What an amazing tool. Saved a bunch of time! ❤️

Flags for factory.createVariableDeclarationList seems to be off. In this simple example shouldn't the flag be ts.NodeFlags.Const only? ts.NodeFlags.Const | ts.NodeFlags.Constant | ts.NodeFlags.Constant === 6 and according to the viewer the actual value is 2.

Playground link: https://ts-ast-viewer.com/#code/KYDwDg9gTgLgBAYwgOwM7wBbADbYnAXjgCIB3abAE2IG4g

Input

export const hello = "world";

Output

[
  factory.createVariableStatement(
    [factory.createToken(ts.SyntaxKind.ExportKeyword)],
    factory.createVariableDeclarationList(
      [factory.createVariableDeclaration(
        factory.createIdentifier("hello"),
        undefined,
        undefined,
        factory.createStringLiteral("world")
      )],
      ts.NodeFlags.Const | ts.NodeFlags.Constant | ts.NodeFlags.Constant
    )
  )
];

When I print that AST I get:

export await using hello = "world";
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