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.
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 {
allowImportExportEverywhere?: boolean | undefined;
allowReturnOutsideFunction?: boolean | undefined;
allowSuperOutsideMethod?: boolean | undefined;
sourceType?: "script" | "module" | undefined;
sourceFilename?: string | undefined;
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.