Walk an oxc-parser
AST with nodes typed correctly.
Same API as estree-walker
, other than needing to await
the walk.
import { parseSync } from 'oxc-parser'
import { walk } from '@knighted/walk'
const ast = parseSync('file.ts', code)
/**
* This package exposes an ESM and CJS build, hence the need for `await`.
* @see https://github.com/Rich-Harris/estree-walker/issues/26#issuecomment-2773408164
*/
await walk(ast.program, {
enter(node) {
// node is correctly typed
},
})