import { PluginPass } from '@babel/core' ; import { TSUnionType , UnionTypeAnnotation , isTSFunctionType , tsParenthesizedType , tsUnionType , } from '@babel/types' ; import { convertFlowType } from './flow-type' ; export function convertUnionTypeAnnotation ( node , state ) { return tsUnionType ( node . types . map ( type => { const tsType = convertFlowType ( type , state ) ; return isTSFunctionType ( tsType ) ? tsParenthesizedType ( tsType ) : tsType ; } ) ) ; }