Socket
Socket
Sign inDemoInstall

@types/babel__traverse

Package Overview
Dependencies
4
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/babel__traverse

TypeScript definitions for @babel/traverse


Version published
Maintainers
1
Weekly downloads
23,190,849
decreased by-6.6%

Weekly downloads

Package description

What is @types/babel__traverse?

The @types/babel__traverse package provides TypeScript type definitions for babel-traverse, which is a part of the Babel compiler. babel-traverse allows for navigating and updating the abstract syntax tree (AST) generated by Babel. This package is essential for TypeScript developers working with Babel, as it enables type checking and IntelliSense for babel-traverse functions and objects.

What are @types/babel__traverse's main functionalities?

Visiting AST Nodes

This feature allows you to visit nodes in the AST and perform actions based on the type of node. The code sample demonstrates how to log the name of each identifier in the AST.

import traverse from '@babel/traverse';
import * as t from '@babel/types';

const ast = // some AST;
traverse(ast, {
  enter(path) {
    if (t.isIdentifier(path.node)) {
      console.log('Found an identifier:', path.node.name);
    }
  }
});

Modifying AST Nodes

This feature enables the modification of nodes within the AST. In the provided code sample, every identifier named 'oldName' is renamed to 'newName'.

import traverse from '@babel/traverse';
import * as t from '@babel/types';

const ast = // some AST;
traverse(ast, {
  enter(path) {
    if (t.isIdentifier(path.node, { name: 'oldName' })) {
      path.node.name = 'newName';
    }
  }
});

Other packages similar to @types/babel__traverse

Readme

Source

Installation

npm install --save @types/babel__traverse

Summary

This package contains type definitions for @babel/traverse (https://github.com/babel/babel/tree/main/packages/babel-traverse).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__traverse.

Additional Details

  • Last updated: Mon, 28 Nov 2022 17:02:52 GMT
  • Dependencies: @types/babel__types
  • Global values: none

Credits

These definitions were written by Troy Gerwien, Marvin Hagemeister, Ryan Petrich, Melvin Groenhoff, Dean L., Ifiok Jr., ExE Boss, and Daniel Tschinder.

FAQs

Last updated on 28 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc