• Version 6.16.9
  • Published
  • 5.89 kB
  • 1 dependency
  • MIT license


npm i @types/babylon
yarn add @types/babylon
pnpm add @types/babylon


TypeScript definitions for babylon



function parse

parse: (code: string, opts?: BabylonOptions) => File;

    function parseExpression

    parseExpression: (input: string, options?: BabylonOptions) => Expression;


      interface BabylonOptions

      interface BabylonOptions {}

        property allowImportExportEverywhere

        allowImportExportEverywhere?: boolean | undefined;
        • 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.

        property allowReturnOutsideFunction

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

        property allowSuperOutsideMethod

        allowSuperOutsideMethod?: boolean | undefined;

          property plugins

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

          property sourceFilename

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

          property sourceType

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

          Type Aliases

          type PluginName

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

            Package Files (1)

            Dependencies (1)

            Dev Dependencies (0)

            No dev dependencies.

            Peer Dependencies (0)

            No peer dependencies.


            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/babylon.

            • Markdown
            • HTML
              <a href="https://www.jsdocs.io/package/@types/babylon"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>