benjamn / benjamn/ast-types

How to get type NodePath in typescript

Open
#364 3 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
194
Avg merge
22h 43m
Merged PRs (30d)
10

Description

When use this module in typescript , can not get a type NodePath.
```ts
import { NodePath} from 'ast-types'
...
recast.visit(ast, {
// 'NodePath' refers to a value, but is being used as a type
visitMemberExpression: (path: NodePath) => {
```
It loss export type after [commit](https://github.com/benjamn/ast-types/commit/6e6ffd86863a4548d12279a17e2e497bb489dfc3#diff-6427dc610ec40c788cba04a9c39d6dcf).
It changes to export a const NodePath, so how to get type NodePath?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the linked commit and the package's TypeScript declarations or exports, then reproduce the reported NodePath usage with the snippet from this issue. Done means consumers can import NodePath and use it as a TypeScript type without the reported value-only error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.