Skip to content

Commit

Permalink
docs-util: fix helper step settings
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser committed Nov 12, 2024
1 parent 7794faf commit ad7b7e8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ const helperStepsOptions: FormattingOptionsType = {
typeParameters: false,
suffix: "- Helper Steps API Reference",
},
reflectionGroups: {
"Type Parameters": false,
},
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -178,4 +179,5 @@ export function registerHelpers(theme: MarkdownTheme) {
workflowDiagramHelper(theme)
workflowHooksHelper(theme)
ifMemberShowTitleHelper(theme)
signatureCommentHelper()
}
Original file line number Diff line number Diff line change
@@ -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)
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{#if (sectionEnabled "member_signature_comment")}}

{{> comment}}
{{{signatureComment}}}

{{/if}}

Expand Down
13 changes: 10 additions & 3 deletions www/utils/packages/utils/src/step-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
}

Expand Down

0 comments on commit ad7b7e8

Please sign in to comment.