mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
feat(website): add support for function overloads (#8474)
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
type ExcerptToken,
|
||||
type Parameter,
|
||||
type TypeParameter,
|
||||
ApiFunction,
|
||||
} from '@microsoft/api-extractor-model';
|
||||
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
||||
import { Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
|
||||
@@ -32,6 +33,9 @@ export function generatePath(items: readonly ApiItem[]) {
|
||||
case ApiItemKind.Package:
|
||||
path += `${item.displayName}/`;
|
||||
break;
|
||||
case ApiItemKind.Function:
|
||||
path += `${item.displayName}:${(item as ApiFunction).overloadIndex}/`;
|
||||
break;
|
||||
default:
|
||||
path += `${item.displayName}/`;
|
||||
}
|
||||
@@ -195,8 +199,10 @@ export function genParameter(model: ApiModel, param: Parameter): ParameterDocume
|
||||
export function getMembers(pkg: ApiPackage) {
|
||||
return pkg.members[0]!.members.map((member) => ({
|
||||
name: member.displayName,
|
||||
kind: member.kind,
|
||||
kind: member.kind as string,
|
||||
path: generatePath(member.getHierarchy()),
|
||||
containerKey: member.containerKey,
|
||||
overloadIndex: member.kind === 'Function' ? (member as ApiFunction).overloadIndex : null,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user