docs: fix incorrect hook details shown (#11225)
This commit is contained in:
1 parent
332ef06534
commit
386ce4b857
13 files changed
+127496
-112779
No files matched your search
+16
-3
@@ -1,6 +1,6 @@
|
||||
import { MarkdownTheme } from "../../theme.js"
|
||||
import Handlebars from "handlebars"
|
||||
import { SignatureReflection } from "typedoc"
|
||||
import { DeclarationReflection, SignatureReflection } from "typedoc"
|
||||
import { cleanUpHookInput, getProjectChild } from "utils"
|
||||
import beautifyCode from "../../utils/beautify-code.js"
|
||||
|
||||
@@ -25,10 +25,23 @@ export default function (theme: MarkdownTheme) {
|
||||
Handlebars.helpers.incrementCurrentTitleLevel()
|
||||
|
||||
const hooksTitleLevel = Handlebars.helpers.titleLevel()
|
||||
const hookChildrenProperty = this.parent?.getChildByName("hooks")
|
||||
const hookChildren =
|
||||
hookChildrenProperty instanceof DeclarationReflection &&
|
||||
hookChildrenProperty.type?.type === "reflection"
|
||||
? hookChildrenProperty.type.declaration.children || []
|
||||
: []
|
||||
|
||||
hooks.forEach((hook) => {
|
||||
// show the hook's input
|
||||
const hookReflection = getProjectChild(theme.project!, hook.name)
|
||||
const hookReflection =
|
||||
hookChildren.find(
|
||||
(child) => child.name === hook.name && child.signatures?.length
|
||||
) ||
|
||||
((this.parent.getChildByName(hook.name) ||
|
||||
getProjectChild(
|
||||
theme.project!,
|
||||
hook.name
|
||||
)) as DeclarationReflection)
|
||||
|
||||
if (
|
||||
!hookReflection ||
|
||||
|
||||
@@ -296,6 +296,7 @@ class WorkflowsPlugin {
|
||||
inputSymbol: initializer.arguments[1].symbol as ts.Symbol,
|
||||
workflowName: workflowVarName,
|
||||
workflowComments,
|
||||
workflowReflection: workflowReflection.parent,
|
||||
})
|
||||
} else {
|
||||
const initializerReflection = findReflectionInNamespaces(
|
||||
@@ -483,12 +484,14 @@ class WorkflowsPlugin {
|
||||
inputSymbol,
|
||||
workflowName,
|
||||
workflowComments,
|
||||
workflowReflection,
|
||||
}: {
|
||||
stepId: string
|
||||
context: Context
|
||||
inputSymbol: ts.Symbol
|
||||
workflowName: string
|
||||
workflowComments?: CommentTag[]
|
||||
workflowReflection: DeclarationReflection
|
||||
}): DeclarationReflection {
|
||||
const declarationReflection = context.createDeclarationReflection(
|
||||
ReflectionKind.Function,
|
||||
@@ -576,6 +579,14 @@ class WorkflowsPlugin {
|
||||
])
|
||||
)
|
||||
|
||||
const hooksProperty = workflowReflection.getChildByName("hooks")
|
||||
if (
|
||||
hooksProperty?.isDeclaration() &&
|
||||
hooksProperty.type?.type === "reflection"
|
||||
) {
|
||||
hooksProperty.type.declaration.addChild(declarationReflection)
|
||||
}
|
||||
|
||||
return declarationReflection
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user