mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
feat(website): add support for type parameter documentation (#8237)
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
type ApiPropertyItem,
|
||||
type ExcerptToken,
|
||||
type Parameter,
|
||||
type TypeParameter,
|
||||
} from '@microsoft/api-extractor-model';
|
||||
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
||||
|
||||
@@ -167,3 +168,22 @@ export function getMembers(pkg: ApiPackage) {
|
||||
path: generatePath(member.getHierarchy()),
|
||||
}));
|
||||
}
|
||||
|
||||
export interface TypeParameterData {
|
||||
name: string;
|
||||
constraintTokens: TokenDocumentation[];
|
||||
defaultTokens: TokenDocumentation[];
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
export function generateTypeParamData(model: ApiModel, typeParam: TypeParameter): TypeParameterData {
|
||||
const constraintTokens = typeParam.constraintExcerpt.spannedTokens.map((token) => genToken(model, token));
|
||||
const defaultTokens = typeParam.defaultTypeExcerpt.spannedTokens.map((token) => genToken(model, token));
|
||||
|
||||
return {
|
||||
name: typeParam.name,
|
||||
constraintTokens,
|
||||
defaultTokens,
|
||||
optional: typeParam.isOptional,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user