Skip to content

[acorn] Missing value property in Token (TypeScript) #1285

@e6nlaq

Description

@e6nlaq
import * as acorn from "acorn";

const token = acorn.tokenizer("const", { ecmaVersion: 6 });

console.log(token.getToken().value);

If you compile a file like the above with tsc, you will get the following error:

index.ts:5:30 - error TS2339: Property 'value' does not exist on type 'Token'.

5 console.log(token.getToken().value);
                               ~~~~~


Found 1 error in index.ts:5

Since the value property actually exists, the type definition is considered incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions