docs-util: fix helper step settings (#10045)

This commit is contained in:
Shahed Nasser
2024-11-13 11:01:14 +02:00
committed by GitHub
parent 868b1c190f
commit 5fec006371
5 changed files with 30 additions and 4 deletions

View File

@@ -45,6 +45,9 @@ const helperStepsOptions: FormattingOptionsType = {
typeParameters: false,
suffix: "- Helper Steps API Reference",
},
reflectionGroups: {
"Type Parameters": false,
},
},
}

View File

@@ -75,6 +75,7 @@ import workflowOutputHelper from "./resources/helpers/workflow-output"
import workflowDiagramHelper from "./resources/helpers/workflow-diagram"
import workflowHooksHelper from "./resources/helpers/workflow-hooks"
import ifMemberShowTitleHelper from "./resources/helpers/if-member-show-title"
import signatureCommentHelper from "./resources/helpers/signature-comment"
import { MarkdownTheme } from "./theme"
const TEMPLATE_PATH = path.join(__dirname, "resources", "templates")
@@ -178,4 +179,5 @@ export function registerHelpers(theme: MarkdownTheme) {
workflowDiagramHelper(theme)
workflowHooksHelper(theme)
ifMemberShowTitleHelper(theme)
signatureCommentHelper()
}

View File

@@ -0,0 +1,14 @@
import * as Handlebars from "handlebars"
import { SignatureReflection } from "typedoc"
export default function () {
Handlebars.registerHelper(
"signatureComment",
function (this: SignatureReflection) {
if (!this.comment && !this.parent.comment) {
return ""
}
return Handlebars.helpers.comments(this.comment || this.parent.comment)
}
)
}

View File

@@ -2,7 +2,7 @@
{{#if (sectionEnabled "member_signature_comment")}}
{{> comment}}
{{{signatureComment}}}
{{/if}}

View File

@@ -3,9 +3,16 @@ import { ArrayType, SignatureReflection, SomeType, UnionType } from "typedoc"
const disallowedIntrinsicTypeNames = ["unknown", "void", "any", "never"]
export function isWorkflowStep(reflection: SignatureReflection): boolean {
return (
reflection.parent?.children?.some((child) => child.name === "__step__") ||
false
if (reflection.parent?.children?.some((child) => child.name === "__step__")) {
return true
}
if (reflection.type?.type !== "intersection") {
return false
}
return reflection.type.types.some(
(refType) =>
refType.type === "reference" &&
refType.name === "StepFunctionReturnConfig"
)
}