Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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