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

6.16.9 • Public • Published

Installation

npm install --save @types/babylon

Summary

This package contains type definitions for babylon (https://github.com/babel/babylon).

Details

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

index.d.ts

import { Expression, File } from "babel-types";

export function parse(code: string, opts?: BabylonOptions): File;

export function parseExpression(input: string, options?: BabylonOptions): Expression;

export interface BabylonOptions {
    /**
     * By default, import and export declarations can only appear at a program's top level.
     * Setting this option to true allows them anywhere where a statement is allowed.
     */
    allowImportExportEverywhere?: boolean | undefined;

    /**
     * By default, a return statement at the top level raises an error. Set this to true to accept such code.
     */
    allowReturnOutsideFunction?: boolean | undefined;

    allowSuperOutsideMethod?: boolean | undefined;

    /**
     * Indicate the mode the code should be parsed in. Can be either "script" or "module".
     */
    sourceType?: "script" | "module" | undefined;

    /**
     * Correlate output AST nodes with their source filename. Useful when
     * generating code and source maps from the ASTs of multiple input files.
     */
    sourceFilename?: string | undefined;

    /**
     * Array containing the plugins that you want to enable.
     */
    plugins?: PluginName[] | undefined;
}

export type PluginName =
    | "estree"
    | "jsx"
    | "flow"
    | "typescript"
    | "classConstructorCall"
    | "doExpressions"
    | "objectRestSpread"
    | "decorators"
    | "classProperties"
    | "exportExtensions"
    | "asyncGenerators"
    | "functionBind"
    | "functionSent"
    | "dynamicImport";

Additional Details

Credits

These definitions were written by Troy Gerwien, and Marvin Hagemeister.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
6.16.9237,146ts5.8
6.16.9237,146ts5.7
6.16.9237,146latest
6.16.9237,146ts4.5
6.16.9237,146ts4.6
6.16.9237,146ts4.7
6.16.9237,146ts4.8
6.16.9237,146ts4.9
6.16.9237,146ts5.0
6.16.9237,146ts5.1
6.16.9237,146ts5.2
6.16.9237,146ts5.3
6.16.9237,146ts5.4
6.16.9237,146ts5.5
6.16.9237,146ts5.6
6.16.9237,146ts5.9
6.16.581,366ts2.8
6.16.581,366ts2.9
6.16.581,366ts3.0
6.16.581,366ts3.1
6.16.581,366ts3.2
6.16.581,366ts3.3
6.16.581,366ts3.4
6.16.581,366ts3.5
6.16.674,591ts3.6
6.16.674,591ts3.7
6.16.674,591ts3.8
6.16.674,591ts3.9
6.16.674,591ts4.0
6.16.674,591ts4.1
6.16.674,591ts4.2
6.16.674,591ts4.3
6.16.674,591ts4.4
6.16.24,358ts2.3
6.16.24,358ts2.4
6.16.24,358ts2.5
6.16.24,358ts2.6
6.16.24,358ts2.7
6.16.1469ts2.0
6.16.1469ts2.1
6.16.1469ts2.2

Version History

VersionDownloads (Last 7 Days)Published
6.16.9237,146
6.16.81,320
6.16.72,525
6.16.674,591
6.16.581,366
6.16.44,159
6.16.39,712
6.16.24,358
6.16.1469
6.16.09
6.7.15264
6.7.142
6.7.132
6.7.12-alpha2
6.7.11-alpha4
6.7.10-alpha2
6.7.9-alpha3
6.7.8-alpha3
6.7.7-alpha3
6.7.2-alpha2
6.7.1-alpha2

Package Sidebar

Install

npm i @types/babylon

Weekly Downloads

415,944

Version

6.16.9

License

MIT

Unpacked Size

5.89 kB

Total Files

5

Last publish

Collaborators

  • types