export function toValueTemplate(nodePath) {
    if (nodePath.isTemplateLiteral()) {
        const result = nodePath.toString();
        if (result.startsWith("`")) {
            return result.slice(1, -1);
        }
        return result;
    }
    const argument = nodePath.get("arguments.0");
    // if you have a return statement and its the only statement in the function, we
    // can consider you a template type (i.e. return `${this.tableData.length}` in a property)
    if (argument.isFunctionExpression() &&
        argument.node.body.body.length === 1 &&
        argument.node.body.body[0]?.type === "ReturnStatement") {
        const returnStatement = argument.get("body.body.0");
        const expression = returnStatement.get("argument");
        if (expression.isTemplateLiteral()) {
            return toValueTemplate(expression);
        }
        return "";
    }
    if (argument.isArrowFunctionExpression()) {
        const body = argument.get("body");
        if (body.isTemplateLiteral()) {
            return toValueTemplate(body);
        }
    }
    return "";
}
//# sourceMappingURL=to-value-template.js.map