ast-types icon indicating copy to clipboard operation
ast-types copied to clipboard

How to get type NodePath in typescript

Open supperchong opened this issue 6 years ago • 3 comments

When use this module in typescript , can not get a type NodePath.

  import { NodePath} from 'ast-types'
  ...
  recast.visit(ast, {
    // 'NodePath' refers to a value, but is being used as a type
    visitMemberExpression: (path: NodePath<recast.types.namedTypes.MemberExpression>) => {

It loss export type after commit. It changes to export a const NodePath, so how to get type NodePath?

supperchong avatar Sep 12 '19 09:09 supperchong

Hey, I'm wondering the same thing.

krasimir avatar Mar 15 '20 13:03 krasimir

I worked around this with import { NodePath } from "ast-types/lib/node-path";.

aterisetri avatar Mar 23 '20 13:03 aterisetri