docs: fix input type of some hooks in workflow reference (#12995)
This commit is contained in:
@@ -115,7 +115,10 @@ export default function (theme: MarkdownTheme) {
|
||||
str += `Handlers consuming this hook accept the following input.\n\n`
|
||||
|
||||
str += Handlebars.helpers.parameterComponent.call(
|
||||
cleanUpHookInput(signatures[0].parameters),
|
||||
cleanUpHookInput(
|
||||
signatures[0].parameters,
|
||||
this.name === "addToCartWorkflow" && hook.name === "validate"
|
||||
),
|
||||
{
|
||||
hash: {
|
||||
sectionTitle: hook.name,
|
||||
|
||||
@@ -41,11 +41,15 @@ export function getHookChildren(
|
||||
}
|
||||
|
||||
export function cleanUpHookInput(
|
||||
parameters: ParameterReflection[]
|
||||
parameters: ParameterReflection[],
|
||||
debug = false
|
||||
): (ParameterReflection | DeclarationReflection)[] {
|
||||
const hasInvokeParameter = parameters.some(
|
||||
(parameter) => parameter.name === "invoke"
|
||||
)
|
||||
if (debug) {
|
||||
console.log(parameters, hasInvokeParameter)
|
||||
}
|
||||
if (hasInvokeParameter) {
|
||||
return getHookInputFromInvoke(parameters)
|
||||
}
|
||||
@@ -98,7 +102,12 @@ function cleanUpReflectionType(reflection: Reflection): Reflection {
|
||||
reflection.type?.type === "intersection" &&
|
||||
reflection.type.types.length >= 2
|
||||
) {
|
||||
reflection.type = reflection.type.types[1]
|
||||
const allReferences = reflection.type.types.every(
|
||||
(type) => type.type === "reference"
|
||||
)
|
||||
if (!allReferences) {
|
||||
reflection.type = reflection.type.types[1]
|
||||
}
|
||||
}
|
||||
|
||||
if (reflection instanceof DeclarationReflection && reflection.children) {
|
||||
|
||||
Reference in New Issue
Block a user