docs: fix empty return in references (#11343)
This commit is contained in:
1 parent
0aa84fc371
commit
ccb332ce41
8 files changed
+40
-32
No files matched your search
-4
@@ -132,10 +132,6 @@ class MyAuthProviderService extends AbstractAuthModuleProvider {
|
|||||||
|
|
||||||
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
<TypeList types={[]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
|
||||||
|
|
||||||
### authenticate
|
### authenticate
|
||||||
|
|
||||||
This method authenticates the user.
|
This method authenticates the user.
|
||||||
|
|||||||
@@ -116,10 +116,6 @@ class MyFileProviderService extends AbstractFileProviderService {
|
|||||||
|
|
||||||
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
<TypeList types={[]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
|
||||||
|
|
||||||
### upload
|
### upload
|
||||||
|
|
||||||
This method uploads a file using your provider's custom logic.
|
This method uploads a file using your provider's custom logic.
|
||||||
|
|||||||
-4
@@ -104,10 +104,6 @@ class MyNotificationProviderService extends AbstractNotificationProviderService
|
|||||||
|
|
||||||
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
<TypeList types={[]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
|
||||||
|
|
||||||
### send
|
### send
|
||||||
|
|
||||||
This method is used to send a notification using the third-party provider or your custom logic.
|
This method is used to send a notification using the third-party provider or your custom logic.
|
||||||
|
|||||||
-4
@@ -135,10 +135,6 @@ class MyPaymentProviderService extends AbstractPaymentProvider<Options> {
|
|||||||
|
|
||||||
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
<TypeList types={[{"name":"options","type":"`Record<any, any>`","description":"The provider's options.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
<TypeList types={[]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateOptions"/>
|
|
||||||
|
|
||||||
### capturePayment
|
### capturePayment
|
||||||
|
|
||||||
This method is used to capture a payment. The payment is captured in one of the following scenarios:
|
This method is used to capture a payment. The payment is captured in one of the following scenarios:
|
||||||
|
|||||||
-4
@@ -79,7 +79,3 @@ myWorkflow()
|
|||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
<TypeList types={[{"name":"message","type":"`string`","description":"An optional message to be logged.","optional":false,"defaultValue":"\"Permanent failure\"","expandable":false,"children":[]},{"name":"compensateInput","type":"`unknown`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="permanentFailure"/>
|
<TypeList types={[{"name":"message","type":"`string`","description":"An optional message to be logged.","optional":false,"defaultValue":"\"Permanent failure\"","expandable":false,"children":[]},{"name":"compensateInput","type":"`unknown`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="permanentFailure"/>
|
||||||
|
|
||||||
## Returns
|
|
||||||
|
|
||||||
<TypeList types={[]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="permanentFailure"/>
|
|
||||||
@@ -10,13 +10,22 @@ export default function (theme: MarkdownTheme) {
|
|||||||
Handlebars.registerHelper(
|
Handlebars.registerHelper(
|
||||||
"returns",
|
"returns",
|
||||||
function (reflection: SignatureReflection) {
|
function (reflection: SignatureReflection) {
|
||||||
|
let returnContent = ""
|
||||||
if (reflection.variant === "signature" && "type" in reflection) {
|
if (reflection.variant === "signature" && "type" in reflection) {
|
||||||
return getReturnFromType(theme, reflection)
|
returnContent = getReturnFromType(theme, reflection)
|
||||||
} else if (reflection.comment) {
|
} else if (reflection.comment) {
|
||||||
return getReturnFromComment(theme, reflection.comment, reflection.name)
|
returnContent = getReturnFromComment(
|
||||||
} else {
|
theme,
|
||||||
|
reflection.comment,
|
||||||
|
reflection.name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!returnContent.length) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return `${Handlebars.helpers.titleLevel()} Returns\n\n${returnContent}`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -44,6 +53,10 @@ function getReturnFromType(
|
|||||||
maxLevel,
|
maxLevel,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!componentItems.length) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if (parameterStyle === "component") {
|
if (parameterStyle === "component") {
|
||||||
return formatParameterComponent({
|
return formatParameterComponent({
|
||||||
parameterComponent,
|
parameterComponent,
|
||||||
|
|||||||
+2
-2
@@ -68,12 +68,12 @@
|
|||||||
|
|
||||||
{{#if type}}
|
{{#if type}}
|
||||||
|
|
||||||
{{{titleLevel}}} Returns
|
|
||||||
|
|
||||||
{{#if (sectionEnabled "member_signature_returns")}}
|
{{#if (sectionEnabled "member_signature_returns")}}
|
||||||
|
|
||||||
{{#with type}}
|
{{#with type}}
|
||||||
|
|
||||||
|
{{{titleLevel}}} Returns
|
||||||
|
|
||||||
{{{type 'all'}}}
|
{{{type 'all'}}}
|
||||||
|
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|||||||
+22
-7
@@ -280,12 +280,27 @@ export function loadComment(
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const emptyValues = ["void", "never", "undefined"]
|
||||||
|
|
||||||
export function isEmpty(reflectionTypes: SomeType[]) {
|
export function isEmpty(reflectionTypes: SomeType[]) {
|
||||||
return reflectionTypes.every(
|
return reflectionTypes.every((type) => {
|
||||||
(type) =>
|
if (type.type === "intrinsic" && emptyValues.includes(type.name)) {
|
||||||
type.type === "intrinsic" &&
|
return true
|
||||||
(type.name === "void" ||
|
}
|
||||||
type.name === "never" ||
|
|
||||||
type.name === "undefined")
|
if (type.type !== "union") {
|
||||||
)
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return type.types.every((unionType) => {
|
||||||
|
if (
|
||||||
|
unionType.type === "intrinsic" &&
|
||||||
|
emptyValues.includes(unionType.name)
|
||||||
|
) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user