mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-30 07:30:09 +00:00
* feat(website): show package members in a sidebar * fix: put response instead of loader * Apply suggestions from code review Co-authored-by: Noel <buechler.noel@outlook.com> * chore: make requested changes * refactor: make only package list scrollable * feat: make sidebar mobile responsive * fix: breakpoints for sidebar Co-authored-by: Noel <buechler.noel@outlook.com>
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import type { ApiFunction, ApiModel, ApiParameterListMixin } from '@microsoft/api-extractor-model';
|
|
import { DocItem } from './DocItem';
|
|
import { TypeParameterMixin } from './TypeParameterMixin';
|
|
import { type TokenDocumentation, genToken, genParameter, ParameterDocumentation } from '~/util/parse.server';
|
|
|
|
export class DocFunction extends TypeParameterMixin(DocItem<ApiFunction>) {
|
|
public readonly returnTypeTokens: TokenDocumentation[];
|
|
public readonly overloadIndex: number;
|
|
public readonly parameters: ParameterDocumentation[];
|
|
|
|
public constructor(model: ApiModel, item: ApiFunction) {
|
|
super(model, item);
|
|
this.returnTypeTokens = item.returnTypeExcerpt.spannedTokens.map((token) => genToken(this.model, token));
|
|
this.overloadIndex = item.overloadIndex;
|
|
this.parameters = (item as ApiParameterListMixin).parameters.map((param) => genParameter(this.model, param));
|
|
}
|
|
|
|
public override toJSON() {
|
|
return {
|
|
...super.toJSON(),
|
|
parameters: this.parameters,
|
|
returnTypeTokens: this.returnTypeTokens,
|
|
overloadIndex: this.overloadIndex,
|
|
};
|
|
}
|
|
}
|