Package detail

@knighted/walk

knightedcodemonkey6.5kMIT1.0.0

Walk an oxc-parser AST with nodes typed correctly.

walk, oxc-parser, ast, node

readme

@knighted/walk

CI codecov NPM version

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
  },
})