babel-plugin-typescript-to-flow
Advanced tools
Comparing version 0.12.4 to 0.12.5
@@ -38,3 +38,3 @@ "use strict"; | ||
} | ||
typeParameters = convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(node.typeParameters); | ||
typeParameters = (0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(node.typeParameters); | ||
} | ||
@@ -52,4 +52,4 @@ let _extends = []; | ||
_extends = [ | ||
t.interfaceExtends(convertMemberExpressionToQualifiedTypeIdentifier_1.convertMemberExpressionToQualifiedTypeIdentifier(node.superClass), node.superTypeParameters | ||
? convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(node.superTypeParameters) | ||
t.interfaceExtends((0, convertMemberExpressionToQualifiedTypeIdentifier_1.convertMemberExpressionToQualifiedTypeIdentifier)(node.superClass), node.superTypeParameters | ||
? (0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(node.superTypeParameters) | ||
: null), | ||
@@ -64,7 +64,7 @@ ]; | ||
if (t.isClassProperty(member)) { | ||
const key = convertKey_1.convertKey(member.key); | ||
const key = (0, convertKey_1.convertKey)(member.key); | ||
const prop = t.objectTypeProperty( | ||
// @ts-ignore | ||
key, t.isTSTypeAnnotation(member.typeAnnotation) | ||
? convertTSType_1.convertTSType(member.typeAnnotation.typeAnnotation) | ||
? (0, convertTSType_1.convertTSType)(member.typeAnnotation.typeAnnotation) | ||
: t.anyTypeAnnotation()); | ||
@@ -85,3 +85,3 @@ // @ts-expect-error todo: @babel/types | ||
: null; | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(member); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(member); | ||
const prop = t.objectTypeProperty( | ||
@@ -114,5 +114,5 @@ // @ts-ignore | ||
} | ||
const id = convertTSEntityName_1.convertTSEntityName(impl.expression); | ||
const id = (0, convertTSEntityName_1.convertTSEntityName)(impl.expression); | ||
const typeParameters = impl.typeParameters | ||
? convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(impl.typeParameters) | ||
? (0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(impl.typeParameters) | ||
: null; | ||
@@ -119,0 +119,0 @@ if (!t.isIdentifier(id)) { |
@@ -30,3 +30,3 @@ "use strict"; | ||
if (node.typeParameters && !t.isNoop(node.typeParameters)) { | ||
typeParams = Object.assign(Object.assign({}, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(node.typeParameters)), baseNodeProps_1.baseNodeProps(node.typeParameters)); | ||
typeParams = Object.assign(Object.assign({}, (0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(node.typeParameters)), (0, baseNodeProps_1.baseNodeProps)(node.typeParameters)); | ||
} | ||
@@ -38,3 +38,3 @@ const parameters = []; | ||
node.returnType && !t.isNoop(node.returnType) | ||
? convertTSType_1.convertTSType(node.returnType.typeAnnotation) | ||
? (0, convertTSType_1.convertTSType)(node.returnType.typeAnnotation) | ||
: null; | ||
@@ -44,3 +44,3 @@ } | ||
returnType = node.typeAnnotation | ||
? convertTSType_1.convertTSType(node.typeAnnotation.typeAnnotation) | ||
? (0, convertTSType_1.convertTSType)(node.typeAnnotation.typeAnnotation) | ||
: null; | ||
@@ -57,3 +57,3 @@ } | ||
if (param.name !== 'this') { | ||
parameters.push(Object.assign(Object.assign({}, t.functionTypeParam(t.identifier(param.name), convertTSType_1.convertTSType(param.typeAnnotation.typeAnnotation))), { optional: param.optional })); | ||
parameters.push(Object.assign(Object.assign({}, t.functionTypeParam(t.identifier(param.name), (0, convertTSType_1.convertTSType)(param.typeAnnotation.typeAnnotation))), { optional: param.optional })); | ||
} | ||
@@ -64,3 +64,3 @@ } | ||
// @ts-ignore todo: | ||
param.argument, convertTSType_1.convertTSType(param.typeAnnotation.typeAnnotation)); | ||
param.argument, (0, convertTSType_1.convertTSType)(param.typeAnnotation.typeAnnotation)); | ||
} | ||
@@ -74,3 +74,3 @@ else { | ||
param.typeAnnotation | ||
? convertTSType_1.convertTSType( | ||
? (0, convertTSType_1.convertTSType)( | ||
// @ts-ignore | ||
@@ -77,0 +77,0 @@ param.typeAnnotation.typeAnnotation) |
@@ -28,5 +28,5 @@ "use strict"; | ||
function convertTSAsExpression(node) { | ||
return Object.assign(Object.assign({}, t.typeCastExpression(node.expression, t.typeAnnotation(Object.assign(Object.assign({}, baseNodeProps_1.baseNodeProps(node.typeAnnotation)), convertTSType_1.convertTSType(node.typeAnnotation))))), recastProps_1.recastProps(node)); | ||
return Object.assign(Object.assign({}, t.typeCastExpression(node.expression, t.typeAnnotation(Object.assign(Object.assign({}, (0, baseNodeProps_1.baseNodeProps)(node.typeAnnotation)), (0, convertTSType_1.convertTSType)(node.typeAnnotation))))), (0, recastProps_1.recastProps)(node)); | ||
} | ||
exports.convertTSAsExpression = convertTSAsExpression; | ||
//# sourceMappingURL=convertTSAsExpression.js.map |
@@ -26,3 +26,3 @@ "use strict"; | ||
function convertTSDeclareFunction(node) { | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(node); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(node); | ||
const id = t.identifier(node.id.name); | ||
@@ -29,0 +29,0 @@ id.typeAnnotation = t.typeAnnotation(t.functionTypeAnnotation(typeParams, parameters, rest, returnType ? returnType : t.anyTypeAnnotation())); |
@@ -32,9 +32,9 @@ "use strict"; | ||
if (node.typeParameters) { | ||
typeParameters = Object.assign(Object.assign({}, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(node.typeParameters)), baseNodeProps_1.baseNodeProps(node.typeParameters)); | ||
typeParameters = Object.assign(Object.assign({}, (0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(node.typeParameters)), (0, baseNodeProps_1.baseNodeProps)(node.typeParameters)); | ||
} | ||
const _extends = node.extends | ||
? node.extends.map(extend => { | ||
const id = convertTSEntityName_1.convertTSEntityName(extend.expression); | ||
const id = (0, convertTSEntityName_1.convertTSEntityName)(extend.expression); | ||
const typeParameters = extend.typeParameters | ||
? convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(extend.typeParameters) | ||
? (0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(extend.typeParameters) | ||
: null; | ||
@@ -44,3 +44,3 @@ return t.interfaceExtends(id, typeParameters); | ||
: []; | ||
const { properties, indexers, callProperties, internalSlots } = convertTSTypeElements_1.convertTSTypeElements(node.body.body); | ||
const { properties, indexers, callProperties, internalSlots } = (0, convertTSTypeElements_1.convertTSTypeElements)(node.body.body); | ||
const body = t.objectTypeAnnotation(properties, indexers, callProperties, internalSlots); | ||
@@ -47,0 +47,0 @@ const interfaceDeclaration = node.declare || isAmbientContext |
@@ -36,3 +36,3 @@ "use strict"; | ||
if (t.isTSArrayType(node)) { | ||
const elementType = Object.assign(Object.assign({}, convertTSType(node.elementType)), baseNodeProps_1.baseNodeProps(node.elementType)); | ||
const elementType = Object.assign(Object.assign({}, convertTSType(node.elementType)), (0, baseNodeProps_1.baseNodeProps)(node.elementType)); | ||
return t.arrayTypeAnnotation( | ||
@@ -78,6 +78,6 @@ // t.isUnionTypeAnnotation(elementType) || t.isIntersectionTypeAnnotation(elementType) | ||
if (t.isTSTypeReference(node)) { | ||
const typeName = convertTSEntityName_1.convertTSEntityName(node.typeName); | ||
const typeName = (0, convertTSEntityName_1.convertTSEntityName)(node.typeName); | ||
let flowTypeParameters = null; | ||
if (node.typeParameters) { | ||
const flowParams = node.typeParameters.params.map(p => (Object.assign(Object.assign({}, convertTSType(p)), baseNodeProps_1.baseNodeProps(p)))); | ||
const flowParams = node.typeParameters.params.map(p => (Object.assign(Object.assign({}, convertTSType(p)), (0, baseNodeProps_1.baseNodeProps)(p)))); | ||
flowTypeParameters = t.typeParameterInstantiation(flowParams); | ||
@@ -170,3 +170,3 @@ } | ||
// } | ||
return Object.assign(Object.assign({}, flowType), baseNodeProps_1.baseNodeProps(v)); | ||
return Object.assign(Object.assign({}, flowType), (0, baseNodeProps_1.baseNodeProps)(v)); | ||
})); | ||
@@ -193,3 +193,3 @@ } | ||
if (t.isTSTypeLiteral(node)) { | ||
return convertTSTypeLiteral_1.convertTSTypeLiteral(node); | ||
return (0, convertTSTypeLiteral_1.convertTSTypeLiteral)(node); | ||
} | ||
@@ -217,3 +217,3 @@ if (t.isTSStringKeyword(node)) { | ||
if (t.isTSEntityName(node.exprName)) { | ||
return t.typeofTypeAnnotation(t.genericTypeAnnotation(convertTSEntityName_1.convertTSEntityName(node.exprName))); | ||
return t.typeofTypeAnnotation(t.genericTypeAnnotation((0, convertTSEntityName_1.convertTSEntityName)(node.exprName))); | ||
} | ||
@@ -259,3 +259,3 @@ if (t.isTSImportType(node.exprName)) { | ||
// } | ||
return Object.assign(Object.assign({}, tsType), baseNodeProps_1.baseNodeProps(v)); | ||
return Object.assign(Object.assign({}, tsType), (0, baseNodeProps_1.baseNodeProps)(v)); | ||
})); | ||
@@ -267,3 +267,3 @@ } | ||
if (t.isTSFunctionType(node)) { | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(node); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(node); | ||
return t.functionTypeAnnotation(typeParams, parameters, rest, returnType ? returnType : t.anyTypeAnnotation()); | ||
@@ -270,0 +270,0 @@ } |
@@ -32,5 +32,5 @@ "use strict"; | ||
return typeAlias(node.id, typeParameters | ||
? Object.assign(Object.assign({}, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(typeParameters)), baseNodeProps_1.baseNodeProps(typeParameters)) : null, Object.assign(Object.assign({}, baseNodeProps_1.baseNodeProps(typeAnnotation)), convertTSType_1.convertTSType(typeAnnotation))); | ||
? Object.assign(Object.assign({}, (0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(typeParameters)), (0, baseNodeProps_1.baseNodeProps)(typeParameters)) : null, Object.assign(Object.assign({}, (0, baseNodeProps_1.baseNodeProps)(typeAnnotation)), (0, convertTSType_1.convertTSType)(typeAnnotation))); | ||
} | ||
exports.convertTSTypeAliasDeclaration = convertTSTypeAliasDeclaration; | ||
//# sourceMappingURL=convertTSTypeAliasDeclaration.js.map |
@@ -27,5 +27,5 @@ "use strict"; | ||
function convertTSTypeAnnotation(node) { | ||
return t.typeAnnotation(Object.assign(Object.assign({}, convertTSType_1.convertTSType(node.typeAnnotation)), baseNodeProps_1.baseNodeProps(node.typeAnnotation))); | ||
return t.typeAnnotation(Object.assign(Object.assign({}, (0, convertTSType_1.convertTSType)(node.typeAnnotation)), (0, baseNodeProps_1.baseNodeProps)(node.typeAnnotation))); | ||
} | ||
exports.convertTSTypeAnnotation = convertTSTypeAnnotation; | ||
//# sourceMappingURL=convertTSTypeAnnotation.js.map |
@@ -34,3 +34,3 @@ "use strict"; | ||
if (t.isTSCallSignatureDeclaration(member)) { | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(member); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(member); | ||
callProperties.push(t.objectTypeCallProperty(t.functionTypeAnnotation(typeParams, parameters, rest, returnType ? returnType : t.anyTypeAnnotation()))); | ||
@@ -42,4 +42,4 @@ } | ||
if (t.isTSPropertySignature(member)) { | ||
const key = convertKey_1.convertKey(member.key); | ||
const prop = t.objectTypeProperty(key, convertTSType_1.convertTSType(member.typeAnnotation.typeAnnotation)); | ||
const key = (0, convertKey_1.convertKey)(member.key); | ||
const prop = t.objectTypeProperty(key, (0, convertTSType_1.convertTSType)(member.typeAnnotation.typeAnnotation)); | ||
if (member.readonly) { | ||
@@ -54,4 +54,4 @@ prop.variance = t.variance('plus'); | ||
if (t.isTSMethodSignature(member)) { | ||
const key = convertKey_1.convertKey(member.key); | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(member); | ||
const key = (0, convertKey_1.convertKey)(member.key); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(member); | ||
const prop = t.objectTypeProperty(key, t.functionTypeAnnotation(typeParams, parameters, rest, returnType ? returnType : t.anyTypeAnnotation())); | ||
@@ -66,4 +66,4 @@ // @ts-ignore todo: @babel-types | ||
if (t.isTSIndexSignature(member)) { | ||
const indexer = t.objectTypeIndexer(t.identifier(member.parameters[0].name), convertTSType_1.convertTSType(member.parameters[0].typeAnnotation | ||
.typeAnnotation), convertTSType_1.convertTSType(member.typeAnnotation.typeAnnotation)); | ||
const indexer = t.objectTypeIndexer(t.identifier(member.parameters[0].name), (0, convertTSType_1.convertTSType)(member.parameters[0].typeAnnotation | ||
.typeAnnotation), (0, convertTSType_1.convertTSType)(member.typeAnnotation.typeAnnotation)); | ||
if (member.readonly) { | ||
@@ -70,0 +70,0 @@ indexer.variance = t.variance('plus'); |
@@ -26,3 +26,3 @@ "use strict"; | ||
function convertTSTypeLiteral(node) { | ||
const { properties, indexers, callProperties, internalSlots } = convertTSTypeElements_1.convertTSTypeElements(node.members); | ||
const { properties, indexers, callProperties, internalSlots } = (0, convertTSTypeElements_1.convertTSTypeElements)(node.members); | ||
const res = t.objectTypeAnnotation(properties, indexers, callProperties, internalSlots); | ||
@@ -29,0 +29,0 @@ return res; |
@@ -28,5 +28,5 @@ "use strict"; | ||
return Object.assign(Object.assign({}, t.typeParameter(node.constraint && | ||
t.typeAnnotation(Object.assign(Object.assign({}, baseNodeProps_1.baseNodeProps(node.constraint)), convertTSType_1.convertTSType(node.constraint))), node.default && Object.assign(Object.assign({}, baseNodeProps_1.baseNodeProps(node.default)), convertTSType_1.convertTSType(node.default)))), { name: node.name }); | ||
t.typeAnnotation(Object.assign(Object.assign({}, (0, baseNodeProps_1.baseNodeProps)(node.constraint)), (0, convertTSType_1.convertTSType)(node.constraint))), node.default && Object.assign(Object.assign({}, (0, baseNodeProps_1.baseNodeProps)(node.default)), (0, convertTSType_1.convertTSType)(node.default)))), { name: node.name }); | ||
} | ||
exports.convertTSTypeParameter = convertTSTypeParameter; | ||
//# sourceMappingURL=convertTSTypeParameter.js.map |
@@ -27,3 +27,3 @@ "use strict"; | ||
function convertTSTypeParameterDeclaration(node) { | ||
const params = node.params.map(p => (Object.assign(Object.assign({}, baseNodeProps_1.baseNodeProps(p)), convertTSTypeParameter_1.convertTSTypeParameter(p)))); | ||
const params = node.params.map(p => (Object.assign(Object.assign({}, (0, baseNodeProps_1.baseNodeProps)(p)), (0, convertTSTypeParameter_1.convertTSTypeParameter)(p)))); | ||
return t.typeParameterDeclaration(params); | ||
@@ -30,0 +30,0 @@ } |
@@ -27,3 +27,3 @@ "use strict"; | ||
function convertTSTypeParameterInstantiation(node) { | ||
const params = node.params.map(p => (Object.assign(Object.assign({}, baseNodeProps_1.baseNodeProps(p)), convertTSType_1.convertTSType(p)))); | ||
const params = node.params.map(p => (Object.assign(Object.assign({}, (0, baseNodeProps_1.baseNodeProps)(p)), (0, convertTSType_1.convertTSType)(p)))); | ||
return t.typeParameterInstantiation(params); | ||
@@ -30,0 +30,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
const template_1 = __importDefault(require("@babel/template")); | ||
const ast = template_1.default({ | ||
const ast = (0, template_1.default)({ | ||
plugins: ['flow'], | ||
@@ -10,0 +10,0 @@ }).ast; |
@@ -41,3 +41,3 @@ "use strict"; | ||
// todo: might be not used | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(node); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(node); | ||
let key; | ||
@@ -44,0 +44,0 @@ if (t.isIdentifier(node.key)) { |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (node.declare || isAmbientContext) { | ||
replaceWith_1.replaceWith(path, convertClassTypeDeclaration_1.convertClassTypeDeclaration(node)); | ||
(0, replaceWith_1.replaceWith)(path, (0, convertClassTypeDeclaration_1.convertClassTypeDeclaration)(node)); | ||
return; | ||
@@ -44,3 +44,3 @@ } | ||
const superTypeParameters = path.get('superTypeParameters'); | ||
superTypeParameters.replaceWith(convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(node.superTypeParameters)); | ||
superTypeParameters.replaceWith((0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(node.superTypeParameters)); | ||
} | ||
@@ -50,5 +50,5 @@ if (node.implements) { | ||
for (const impl of impls) { | ||
const id = convertTSEntityName_1.convertTSEntityName(impl.node.expression); | ||
const id = (0, convertTSEntityName_1.convertTSEntityName)(impl.node.expression); | ||
const typeParameters = impl.node.typeParameters | ||
? convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(impl.node.typeParameters) | ||
? (0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(impl.node.typeParameters) | ||
: null; | ||
@@ -63,8 +63,8 @@ if (!t.isIdentifier(id)) { | ||
t.isTSTypeParameterDeclaration(node.typeParameters)) { | ||
path.get('typeParameters').replaceWith(convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(node.typeParameters)); | ||
path.get('typeParameters').replaceWith((0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(node.typeParameters)); | ||
} | ||
// todo @babel/types | ||
transformClassBody_1.transformClassBody(path.get('body')); | ||
(0, transformClassBody_1.transformClassBody)(path.get('body')); | ||
} | ||
exports.transformClassDeclaration = transformClassDeclaration; | ||
//# sourceMappingURL=transformClassDeclaration.js.map |
@@ -6,5 +6,5 @@ "use strict"; | ||
function baseNodeProps(node) { | ||
return Object.assign({ leadingComments: node.leadingComments, innerComments: node.innerComments, trailingComments: node.trailingComments, start: null, end: null, loc: node.loc }, recastProps_1.recastProps(node)); | ||
return Object.assign({ leadingComments: node.leadingComments, innerComments: node.innerComments, trailingComments: node.trailingComments, start: null, end: null, loc: node.loc }, (0, recastProps_1.recastProps)(node)); | ||
} | ||
exports.baseNodeProps = baseNodeProps; | ||
//# sourceMappingURL=baseNodeProps.js.map |
@@ -28,4 +28,4 @@ "use strict"; | ||
if (t.isTSTypeParameterDeclaration(path.node.typeParameters)) { | ||
const tsTypeParameterDeclaration = convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(path.node.typeParameters); | ||
replaceWith_1.replaceWith(path.get('typeParameters'), tsTypeParameterDeclaration); | ||
const tsTypeParameterDeclaration = (0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(path.node.typeParameters); | ||
(0, replaceWith_1.replaceWith)(path.get('typeParameters'), tsTypeParameterDeclaration); | ||
} | ||
@@ -32,0 +32,0 @@ } |
@@ -8,5 +8,5 @@ "use strict"; | ||
if (path.node.typeParameters) { | ||
const typeParameters = convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(path.node.typeParameters); | ||
const typeParameters = (0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(path.node.typeParameters); | ||
path.node.typeParameters = null; | ||
replaceWith_1.replaceWith(path.get('typeArguments'), typeParameters); | ||
(0, replaceWith_1.replaceWith)(path.get('typeArguments'), typeParameters); | ||
} | ||
@@ -13,0 +13,0 @@ } |
@@ -7,5 +7,5 @@ "use strict"; | ||
const isAmbientContext = state.opts.isAmbientContext; | ||
transformClassDeclaration_1.transformClassDeclaration(path, isAmbientContext); | ||
(0, transformClassDeclaration_1.transformClassDeclaration)(path, isAmbientContext); | ||
} | ||
exports.ClassDeclaration = ClassDeclaration; | ||
//# sourceMappingURL=ClassDeclaration.js.map |
@@ -33,3 +33,3 @@ "use strict"; | ||
if (t.isTSDeclareFunction(srcDeclaration)) { | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(srcDeclaration); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(srcDeclaration); | ||
const id = t.identifier(((_a = srcDeclaration === null || srcDeclaration === void 0 ? void 0 : srcDeclaration.id) === null || _a === void 0 ? void 0 : _a.name) || 'fn'); | ||
@@ -40,7 +40,7 @@ id.typeAnnotation = t.typeAnnotation(t.functionTypeAnnotation(typeParams, parameters, rest, returnType ? returnType : t.anyTypeAnnotation())); | ||
replacement.default = true; | ||
replaceWith_1.replaceWith(path, replacement); | ||
(0, replaceWith_1.replaceWith)(path, replacement); | ||
} | ||
else if (t.isClassDeclaration(srcDeclaration)) { | ||
const replacement = t.declareExportDeclaration(convertClassTypeDeclaration_1.convertClassTypeDeclaration(srcDeclaration)); | ||
replaceWith_1.replaceWith(path, replacement); | ||
const replacement = t.declareExportDeclaration((0, convertClassTypeDeclaration_1.convertClassTypeDeclaration)(srcDeclaration)); | ||
(0, replaceWith_1.replaceWith)(path, replacement); | ||
} | ||
@@ -47,0 +47,0 @@ } |
@@ -40,3 +40,3 @@ "use strict"; | ||
// todo: copypaste from ExportDefaultDeclaration.ts | ||
const { typeParams, parameters, rest, returnType } = convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation(srcDeclaration); | ||
const { typeParams, parameters, rest, returnType } = (0, convertFunctionTypeAnnotation_1.convertFunctionTypeAnnotation)(srcDeclaration); | ||
const id = t.identifier(srcDeclaration.id.name); | ||
@@ -46,8 +46,8 @@ id.typeAnnotation = t.typeAnnotation(t.functionTypeAnnotation(typeParams, parameters, rest, returnType ? returnType : t.anyTypeAnnotation())); | ||
const replacement = t.declareExportDeclaration(declaration); | ||
replaceWith_1.replaceWith(path, replacement); | ||
(0, replaceWith_1.replaceWith)(path, replacement); | ||
// todo: remove typecast to any | ||
} | ||
else if (t.isClassDeclaration(srcDeclaration)) { | ||
const replacement = t.declareExportDeclaration(convertClassTypeDeclaration_1.convertClassTypeDeclaration(srcDeclaration)); | ||
replaceWith_1.replaceWith(path, replacement); | ||
const replacement = t.declareExportDeclaration((0, convertClassTypeDeclaration_1.convertClassTypeDeclaration)(srcDeclaration)); | ||
(0, replaceWith_1.replaceWith)(path, replacement); | ||
} | ||
@@ -54,0 +54,0 @@ else if (srcDeclaration && srcDeclaration.declare) { |
@@ -8,5 +8,5 @@ "use strict"; | ||
if (path.node.typeParameters) { | ||
const typeParameters = convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation(path.node.typeParameters); | ||
const typeParameters = (0, convertTSTypeParameterInstantiation_1.convertTSTypeParameterInstantiation)(path.node.typeParameters); | ||
path.node.typeParameters = null; | ||
replaceWith_1.replaceWith(path.get('typeArguments'), typeParameters); | ||
(0, replaceWith_1.replaceWith)(path.get('typeArguments'), typeParameters); | ||
} | ||
@@ -13,0 +13,0 @@ } |
@@ -40,12 +40,12 @@ "use strict"; | ||
if (t.isTSTypeAliasDeclaration(node)) { | ||
const replacement = convertTSTypeAliasDeclaration_1.convertTSTypeAliasDeclaration(node, isAmbientContext); | ||
replaceWith_1.replaceWith(st, replacement); | ||
const replacement = (0, convertTSTypeAliasDeclaration_1.convertTSTypeAliasDeclaration)(node, isAmbientContext); | ||
(0, replaceWith_1.replaceWith)(st, replacement); | ||
} | ||
// todo: isClassDeclaration on NodePath | ||
if (t.isClassDeclaration(node)) { | ||
transformClassDeclaration_1.transformClassDeclaration(st, isAmbientContext); | ||
(0, transformClassDeclaration_1.transformClassDeclaration)(st, isAmbientContext); | ||
} | ||
// todo: isTSInterfaceDeclaration on NodePath | ||
if (t.isTSInterfaceDeclaration(node)) { | ||
replaceWith_1.replaceWith(st, convertTSInterfaceDeclaration_1.convertTSInterfaceDeclaration(node, isAmbientContext)); | ||
(0, replaceWith_1.replaceWith)(st, (0, convertTSInterfaceDeclaration_1.convertTSInterfaceDeclaration)(node, isAmbientContext)); | ||
} | ||
@@ -56,4 +56,4 @@ if (t.isTSDeclareFunction(node)) { | ||
} | ||
const replacement = convertTSDeclareFunction_1.convertTSDeclareFunction(node); | ||
replaceWith_1.replaceWith(st, replacement); | ||
const replacement = (0, convertTSDeclareFunction_1.convertTSDeclareFunction)(node); | ||
(0, replaceWith_1.replaceWith)(st, replacement); | ||
} | ||
@@ -60,0 +60,0 @@ } |
@@ -7,5 +7,5 @@ "use strict"; | ||
function TSAsExpression(path) { | ||
replaceWith_1.replaceWith(path, convertTSAsExpression_1.convertTSAsExpression(path.node)); | ||
(0, replaceWith_1.replaceWith)(path, (0, convertTSAsExpression_1.convertTSAsExpression)(path.node)); | ||
} | ||
exports.TSAsExpression = TSAsExpression; | ||
//# sourceMappingURL=TSAsExpression.js.map |
@@ -8,4 +8,4 @@ "use strict"; | ||
if (path.node.declare) { | ||
const replacement = convertTSDeclareFunction_1.convertTSDeclareFunction(path.node); | ||
replaceWith_1.replaceWith(path, replacement); | ||
const replacement = (0, convertTSDeclareFunction_1.convertTSDeclareFunction)(path.node); | ||
(0, replaceWith_1.replaceWith)(path, replacement); | ||
} | ||
@@ -12,0 +12,0 @@ else { |
@@ -7,5 +7,5 @@ "use strict"; | ||
function TSInterfaceDeclaration(path) { | ||
replaceWith_1.replaceWith(path, convertTSInterfaceDeclaration_1.convertTSInterfaceDeclaration(path.node)); | ||
(0, replaceWith_1.replaceWith)(path, (0, convertTSInterfaceDeclaration_1.convertTSInterfaceDeclaration)(path.node)); | ||
} | ||
exports.TSInterfaceDeclaration = TSInterfaceDeclaration; | ||
//# sourceMappingURL=TSInterfaceDeclaration.js.map |
@@ -7,6 +7,6 @@ "use strict"; | ||
function TSTypeAliasDeclaration(path) { | ||
const replacement = convertTSTypeAliasDeclaration_1.convertTSTypeAliasDeclaration(path.node); | ||
replaceWith_1.replaceWith(path, replacement); | ||
const replacement = (0, convertTSTypeAliasDeclaration_1.convertTSTypeAliasDeclaration)(path.node); | ||
(0, replaceWith_1.replaceWith)(path, replacement); | ||
} | ||
exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration; | ||
//# sourceMappingURL=TSTypeAliasDeclaration.js.map |
@@ -7,5 +7,5 @@ "use strict"; | ||
function TSTypeAnnotation(path) { | ||
replaceWith_1.replaceWith(path, convertTSTypeAnnotation_1.convertTSTypeAnnotation(path.node)); | ||
(0, replaceWith_1.replaceWith)(path, (0, convertTSTypeAnnotation_1.convertTSTypeAnnotation)(path.node)); | ||
} | ||
exports.TSTypeAnnotation = TSTypeAnnotation; | ||
//# sourceMappingURL=TSTypeAnnotation.js.map |
@@ -7,5 +7,5 @@ "use strict"; | ||
function TSTypeParameterDeclaration(path) { | ||
replaceWith_1.replaceWith(path, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration(path.node)); | ||
(0, replaceWith_1.replaceWith)(path, (0, convertTSTypeParameterDeclaration_1.convertTSTypeParameterDeclaration)(path.node)); | ||
} | ||
exports.TSTypeParameterDeclaration = TSTypeParameterDeclaration; | ||
//# sourceMappingURL=TSTypeParameterDeclaration.js.map |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.12.4", | ||
"version": "0.12.5", | ||
"scripts": { | ||
@@ -30,23 +30,23 @@ "cover": "jest --coverage", | ||
"dependencies": { | ||
"@babel/template": "^7.14.5", | ||
"@babel/traverse": "^7.14.8", | ||
"@babel/types": "^7.14.8" | ||
"@babel/template": "^7.15.4", | ||
"@babel/traverse": "^7.15.4", | ||
"@babel/types": "^7.15.6" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-proposal-class-properties": "^7.14.5", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.14.5", | ||
"@babel/preset-env": "^7.14.8", | ||
"@babel/preset-typescript": "^7.14.5", | ||
"@flowts/babel-plugin-recast": "^0.12.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.15.6", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-typescript": "^7.15.0", | ||
"@flowts/babel-plugin-recast": "^0.12.5", | ||
"@types/babel__traverse": "7.14.2", | ||
"@types/jest": "^26.0.24", | ||
"@typescript-eslint/eslint-plugin": "^4.28.4", | ||
"@typescript-eslint/parser": "^4.28.4", | ||
"@types/jest": "^27.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.31.0", | ||
"@typescript-eslint/parser": "^4.31.0", | ||
"@zxbodya/recast": "0.20.9", | ||
"eslint": "^7.31.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.3.2", | ||
"jest": "^27.1.1", | ||
"prettier": "^2.4.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.3.5" | ||
"typescript": "^4.4.3" | ||
}, | ||
@@ -59,3 +59,3 @@ "jest": { | ||
}, | ||
"gitHead": "4751214be2909a908ea1fb0aa1acd80f74af7355" | ||
"gitHead": "9f316f0a62a9caf45262eadf7a5ca0a660148624" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
143711
Updated@babel/template@^7.15.4
Updated@babel/traverse@^7.15.4
Updated@babel/types@^7.15.6