src/language-js/print/function.js/printFunctionDeclaration
function printFunctionDeclaration(path, print, options, expandArg) {
  const n = path.getValue();
  const parts = [];

  // For TypeScript the TSDeclareFunction node shares the AST
  // structure with FunctionDeclaration
  if (n.type === "TSDeclareFunction" && n.declare) {
    parts.push("declare ");
  }

  if (n.async) {
    parts.push("async ");
  }

  if (n.generator) {
    parts.push("function* ");
  } else {
    parts.push("function ");
  }

  if (n.id) {
    parts.push(path.call(print, "id"));
  }

  parts.push(
    printFunctionTypeParameters(path, options, print),
    group(
      concat([
        printFunctionParameters(path, print, options, expandArg),
        printReturnType(path, print, options),
      ])
    ),
    n.body ? " " : "",
    path.call(print, "body")
  );

  if (options.semi && (n.declare || !n.body)) {
    parts.push(";");
  }

  return concat(parts);
}