Skip to content

Wrong TS types: BaseNode instead of Node #28

@ksh-ns

Description

@ksh-ns

Hey, I'm using the svelte compiler to walk the AST. I'm using Typescript and it seems that the typings are wrong for the node that passed to the walk function - https://github.com/Rich-Harris/estree-walker/blob/master/src/async.js#L4

image

It's typed as BaseNode, but the possible results are some sort of of Node + INode mixed type (eg. ModuleSpecifier for import statements). The dependencies:

{
    "svelte": "^3.38.2",
    "@types/estree": "^0.0.48",
    "estree-walker": "^3.0.0"
}

P.S. Also Svelte doesn't automatically include those types, you need to install more of the packages. This isn't ideal as you could miss-match the dependency versions. Maybe there is a conventional way to bundle types, without the need for the user to install svelte's sub-dependencies? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions