mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
fix: doc generation for return types
This commit is contained in:
@@ -44,10 +44,12 @@ export class DocumentedMethod extends DocumentedItem<Method | DeclarationReflect
|
|||||||
? (signature as SignatureReflection).parameters?.map((p) => new DocumentedParam(p, this.config).serialize())
|
? (signature as SignatureReflection).parameters?.map((p) => new DocumentedParam(p, this.config).serialize())
|
||||||
: undefined,
|
: undefined,
|
||||||
returns: signature.type
|
returns: signature.type
|
||||||
? new DocumentedVarType(
|
? [
|
||||||
{ names: [parseType(signature.type)], description: signature.comment?.returns?.trim() },
|
new DocumentedVarType(
|
||||||
this.config,
|
{ names: [parseType(signature.type)], description: signature.comment?.returns?.trim() },
|
||||||
).serialize()
|
this.config,
|
||||||
|
).serialize(),
|
||||||
|
]
|
||||||
: undefined,
|
: undefined,
|
||||||
returnsDescription: signature.comment?.returns?.trim(),
|
returnsDescription: signature.comment?.returns?.trim(),
|
||||||
meta,
|
meta,
|
||||||
|
|||||||
@@ -122,10 +122,12 @@ export class DocumentedTypeDef extends DocumentedItem<Typedef | DeclarationRefle
|
|||||||
deprecated: sig?.comment?.tags?.some((t) => t.tagName === 'deprecated'),
|
deprecated: sig?.comment?.tags?.some((t) => t.tagName === 'deprecated'),
|
||||||
params,
|
params,
|
||||||
returns: sig?.type
|
returns: sig?.type
|
||||||
? new DocumentedVarType(
|
? [
|
||||||
{ names: [parseType(sig.type)], description: sig.comment?.returns?.trim() },
|
new DocumentedVarType(
|
||||||
this.config,
|
{ names: [parseType(sig.type)], description: sig.comment?.returns?.trim() },
|
||||||
).serialize()
|
this.config,
|
||||||
|
).serialize(),
|
||||||
|
]
|
||||||
: undefined,
|
: undefined,
|
||||||
returnsDescription: sig?.comment?.returns?.trim(),
|
returnsDescription: sig?.comment?.returns?.trim(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ export class DocumentedVarType extends DocumentedItem<VarType> {
|
|||||||
const names = data.names?.map((name) => splitVarName(parseType(name)));
|
const names = data.names?.map((name) => splitVarName(parseType(name)));
|
||||||
|
|
||||||
if (!data.description && !data.nullable) {
|
if (!data.description && !data.nullable) {
|
||||||
return [names];
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
types: [names],
|
types: names,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
nullable: data.nullable,
|
nullable: data.nullable,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user