import { PluginPass } from '@babel/core' ; import { DeclareOpaqueType , OpaqueType , TSTypeAliasDeclaration , tsAnyKeyword , tsTypeAliasDeclaration , } from '@babel/types' ; import { convertFlowType } from './flow-type' ; import { convertTypeParameterDeclaration } from './type-parameter' ; export function convertOpaqueType ( node , state ) { const typeParameters = convertTypeParameterDeclaration ( node . typeParameters , state ) ; return tsTypeAliasDeclaration ( node . id , typeParameters , convertFlowType ( node . impltype , state ) ) ; } export function convertDeclareOpaqueType ( node , state ) { const typeParameters = convertTypeParameterDeclaration ( node . typeParameters , state ) ; const tsTypeAlias = tsTypeAliasDeclaration ( node . id , typeParameters , tsAnyKeyword ( ) ) ; tsTypeAlias . declare = true ; return tsTypeAlias ; }