@types/esprima-walk
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Installation

npm install --save @types/esprima-walk

Summary

This package contains type definitions for esprima-walk (https://github.com/jrajav/esprima-walk).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/esprima-walk.

index.d.ts

import * as ESTree from "estree";

type NodeWithParent = ESTree.Node & { parent?: ESTree.Node | undefined };

/**
 * Walk the provided AST; fn is called once for each node with a `type`
 * @param {ESTree.Program} ast program to walk
 * @param {function} fn function invoked for each node with type
 */
declare function walk(ast: ESTree.Program, fn: (node: ESTree.Node) => void): void;

declare namespace walk {
    /**
     * Walk the provided AST; fn is called once for each node with a `type`
     * @param {ESTree.Program} ast program to walk
     * @param {function} fn function invoked for each node
     */
    export function walk(ast: ESTree.Program, fn: (node: ESTree.Node) => void): void;

    /**
     * Walk the provided AST; fn is called once for each node with a `type`.
     * Adds a parent property prior to invoking fn when applicable
     * @param {ESTree.Program} ast program to walk
     * @param {function} fn function invoked for each node
     */
    export function walkAddParent(ast: ESTree.Program, fn: (node: NodeWithParent) => void): void;
}

export = walk;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/estree

Credits

These definitions were written by tswaters.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/esprima-walk

Weekly Downloads

185

Version

0.1.5

License

MIT

Unpacked Size

4.81 kB

Total Files

5

Last publish

Collaborators

  • types