mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13: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())
|
||||
: undefined,
|
||||
returns: signature.type
|
||||
? new DocumentedVarType(
|
||||
{ names: [parseType(signature.type)], description: signature.comment?.returns?.trim() },
|
||||
this.config,
|
||||
).serialize()
|
||||
? [
|
||||
new DocumentedVarType(
|
||||
{ names: [parseType(signature.type)], description: signature.comment?.returns?.trim() },
|
||||
this.config,
|
||||
).serialize(),
|
||||
]
|
||||
: undefined,
|
||||
returnsDescription: signature.comment?.returns?.trim(),
|
||||
meta,
|
||||
|
||||
@@ -122,10 +122,12 @@ export class DocumentedTypeDef extends DocumentedItem<Typedef | DeclarationRefle
|
||||
deprecated: sig?.comment?.tags?.some((t) => t.tagName === 'deprecated'),
|
||||
params,
|
||||
returns: sig?.type
|
||||
? new DocumentedVarType(
|
||||
{ names: [parseType(sig.type)], description: sig.comment?.returns?.trim() },
|
||||
this.config,
|
||||
).serialize()
|
||||
? [
|
||||
new DocumentedVarType(
|
||||
{ names: [parseType(sig.type)], description: sig.comment?.returns?.trim() },
|
||||
this.config,
|
||||
).serialize(),
|
||||
]
|
||||
: undefined,
|
||||
returnsDescription: sig?.comment?.returns?.trim(),
|
||||
};
|
||||
|
||||
@@ -10,11 +10,11 @@ export class DocumentedVarType extends DocumentedItem<VarType> {
|
||||
const names = data.names?.map((name) => splitVarName(parseType(name)));
|
||||
|
||||
if (!data.description && !data.nullable) {
|
||||
return [names];
|
||||
return names;
|
||||
}
|
||||
|
||||
return {
|
||||
types: [names],
|
||||
types: names,
|
||||
description: data.description,
|
||||
nullable: data.nullable,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user