in src/utils/resolveGenericTypeAnnotation.ts [8:42]
function tryResolveGenericTypeAnnotation(
path: NodePath,
importer: Importer,
): NodePath | undefined {
let typePath = unwrapUtilityType(path);
let idPath;
if (typePath.node.id) {
idPath = typePath.get('id');
} else if (t.TSTypeReference.check(typePath.node)) {
idPath = typePath.get('typeName');
} else if (t.TSExpressionWithTypeArguments.check(typePath.node)) {
idPath = typePath.get('expression');
}
if (idPath) {
typePath = resolveToValue(idPath, importer);
if (isUnreachableFlowType(typePath)) {
return;
}
if (t.TypeAlias.check(typePath.node)) {
return tryResolveGenericTypeAnnotation(typePath.get('right'), importer);
} else if (t.TSTypeAliasDeclaration.check(typePath.node)) {
return tryResolveGenericTypeAnnotation(
typePath.get('typeAnnotation'),
importer,
);
}
return typePath;
}
return typePath;
}