How to use the @babel/plugin-syntax-flow.default function in @babel/plugin-syntax-flow

To help you get started, we’ve selected a few @babel/plugin-syntax-flow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erukiti / ast-book-sample / chapter6 / overload.js View on Github external
const path = require('path')

const {transformFileSync} = require('@babel/core')
// const syntaxTypeScript = require('@babel/plugin-syntax-typescript').default
const syntaxFlow = require('@babel/plugin-syntax-flow').default
const stripType = require('@babel/plugin-transform-flow-strip-types').default

const WasCreated = Symbol('WasCreated')

const overloadPlugin = ({types: t}) => {
  const getTypeAnnotation = nodePath => {
    if (!t.isIdentifier(nodePath.node)) {
      return null
    }

    const binding = nodePath.scope.bindings[nodePath.node.name]

    if (!binding || !('typeAnnotation' in binding.identifier)) {
      return null
    }
    const {identifier} = binding

@babel/plugin-syntax-flow

Allow parsing of the flow syntax

MIT
Latest version published 11 days ago

Package Health Score

95 / 100
Full package analysis

Popular @babel/plugin-syntax-flow functions