Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "flow2ts", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "flow", |
@@ -342,2 +342,3 @@ import { NodePath } from '@babel/traverse'; | ||
body: NodePath<t.ObjectTypeAnnotation>, | ||
additionalExtends: t.TSExpressionWithTypeArguments[] = [], | ||
): t.BaseNode => { | ||
@@ -352,3 +353,3 @@ const typeParameters = convertTypeParameters(typeParametersIn); | ||
const tsTypeParameters = convertTypeParameterInstantiation(argument.get('typeParameters')); | ||
return t.tsExpressionWithTypeArguments(argument.node.id, tsTypeParameters); | ||
return t.tsExpressionWithTypeArguments(t.identifier(argument.node.id.name), tsTypeParameters); | ||
} | ||
@@ -360,4 +361,5 @@ } | ||
const bodyOut = t.tsInterfaceBody(convertAllProperties(body)); | ||
const allExtends = additionalExtends.concat(extend); | ||
const decl = t.tsInterfaceDeclaration(id, typeParameters, extend.length === 0 ? null : extend, bodyOut); | ||
const decl = t.tsInterfaceDeclaration(id, typeParameters, allExtends.length === 0 ? null : allExtends, bodyOut); | ||
decl.loc = id.loc; | ||
@@ -367,2 +369,9 @@ return decl; | ||
const convertInterfaceExtends = ( | ||
path: NodePath<t.InterfaceExtends>, | ||
): t.TSExpressionWithTypeArguments => { | ||
const tsTypeParameters = convertTypeParameterInstantiation(path.get('typeParameters')); | ||
return t.tsExpressionWithTypeArguments(t.identifier(path.node.id.name), tsTypeParameters); | ||
} | ||
const convertInterfaceDeclaration = (path: NodePath<t.InterfaceDeclaration>) => convertInterface( | ||
@@ -372,2 +381,5 @@ path.node.id, | ||
path.get('body'), | ||
(path.node as any).extends == null | ||
? [] | ||
: (path.node as any).extends.map((_: any, idx: number) => convertInterfaceExtends(path.get(`extends.${idx}`))), | ||
); | ||
@@ -374,0 +386,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72470
1585