From b79351ba99d71b1c0e9263539634cd2532ee7b60 Mon Sep 17 00:00:00 2001 From: Qjuh <76154676+Qjuh@users.noreply.github.com> Date: Mon, 13 Nov 2023 09:55:23 +0100 Subject: [PATCH] fix(website): misc improvements (#9940) * refactor: use tokenRange for typeParams in heritage * fix: correct type param replacement * fix: ae config, link builtin in summary, `: | T` => `: T`, mainlib tsdoc * fix: requested changes and tests * chore: better deprecation messages and code cleanup * fix: cleanup optional chainings --------- Co-authored-by: Almeida --- api-extractor.json | 78 ++++++++++--------- .../components/documentation/tsdoc/TSDoc.tsx | 25 +++++- .../api-extractor/config/api-extractor.json | 4 +- .../api-extractor/src/collector/Collector.ts | 2 +- .../src/generators/ApiModelGenerator.ts | 27 ++++--- .../src/generators/ExcerptBuilder.ts | 27 +++++-- packages/discord.js/typings/index.d.ts | 68 ++++++++-------- 7 files changed, 134 insertions(+), 97 deletions(-) diff --git a/api-extractor.json b/api-extractor.json index 736568c70..78b15baef 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -89,48 +89,50 @@ * DEFAULT VALUE: no overrideTsconfig section */ "overrideTsconfig": { - // Type Checking - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "exactOptionalPropertyTypes": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noPropertyAccessFromIndexSignature": false, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "strict": true, + "compilerOptions": { + // Type Checking + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "exactOptionalPropertyTypes": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": false, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, - // Modules - "allowArbitraryExtensions": false, - "allowImportingTsExtensions": false, - "module": "ESNext", - "moduleResolution": "node", - "resolveJsonModule": true, - "resolvePackageJsonExports": false, - "resolvePackageJsonImports": false, + // Modules + "allowArbitraryExtensions": false, + "allowImportingTsExtensions": false, + "module": "ESNext", + "moduleResolution": "nodenext", + "resolveJsonModule": true, + "resolvePackageJsonExports": false, + "resolvePackageJsonImports": false, - // Emit - "declaration": true, - "declarationMap": true, - "importHelpers": false, - "newLine": "lf", - "noEmitHelpers": true, - "outDir": "dist", - "removeComments": false, - "sourceMap": true, + // Emit + "declaration": true, + "declarationMap": true, + "importHelpers": false, + "newLine": "lf", + "noEmitHelpers": true, + "outDir": "dist", + "removeComments": false, + "sourceMap": true, - // Interop Constraints - "esModuleInterop": false, - "forceConsistentCasingInFileNames": true, - "isolatedModules": true, + // Interop Constraints + "esModuleInterop": false, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, - // Language and Environment - "experimentalDecorators": true, - "lib": ["ESNext"], - "target": "ES2022", - "useDefineForClassFields": true + // Language and Environment + "experimentalDecorators": true, + "lib": ["ESNext"], + "target": "ES2022", + "useDefineForClassFields": true + } } /** * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended diff --git a/apps/website/src/components/documentation/tsdoc/TSDoc.tsx b/apps/website/src/components/documentation/tsdoc/TSDoc.tsx index 3572ad128..fbddbe3c6 100644 --- a/apps/website/src/components/documentation/tsdoc/TSDoc.tsx +++ b/apps/website/src/components/documentation/tsdoc/TSDoc.tsx @@ -4,6 +4,8 @@ import { DocNodeKind, StandardTags } from '@microsoft/tsdoc'; import type { Route } from 'next'; import Link from 'next/link'; import { Fragment, useCallback, type ReactNode } from 'react'; +import { DocumentationLink } from '~/components/DocumentationLink'; +import { BuiltinDocumentationLinks } from '~/util/builtinDocumentationLinks'; import { ItemLink } from '../../ItemLink'; import { SyntaxHighlighter } from '../../SyntaxHighlighter'; import { resolveItemURI } from '../util'; @@ -32,10 +34,24 @@ export function TSDoc({ item, tsdoc }: { readonly item: ApiItem; readonly tsdoc: const { codeDestination, urlDestination, linkText } = tsdoc as DocLinkTag; if (codeDestination) { - // TODO: Real fix in api-extractor needed - const currentItem = item.getAssociatedPackage(); - const foundItem = item.getAssociatedModel()?.resolveDeclarationReference(codeDestination, currentItem) - .resolvedApiItem; + if ( + !codeDestination.importPath && + !codeDestination.packageName && + codeDestination.memberReferences.length === 1 && + codeDestination.memberReferences[0]!.memberIdentifier && + codeDestination.memberReferences[0]!.memberIdentifier.identifier in BuiltinDocumentationLinks + ) { + const typeName = codeDestination.memberReferences[0]!.memberIdentifier.identifier; + const href = BuiltinDocumentationLinks[typeName as keyof typeof BuiltinDocumentationLinks]; + return ( + + {typeName} + + ); + } + + const declarationReference = item.getAssociatedModel()?.resolveDeclarationReference(codeDestination, item); + const foundItem = declarationReference?.resolvedApiItem; if (!foundItem) return null; @@ -44,6 +60,7 @@ export function TSDoc({ item, tsdoc }: { readonly item: ApiItem; readonly tsdoc: className="rounded font-mono text-blurple outline-none focus:ring focus:ring-width-2 focus:ring-blurple" itemURI={resolveItemURI(foundItem)} key={idx} + packageName={item.getAssociatedPackage()?.displayName.replace('@discordjs/', '')} > {linkText ?? foundItem.displayName} diff --git a/packages/api-extractor/config/api-extractor.json b/packages/api-extractor/config/api-extractor.json index c4d10dfdc..58691092e 100644 --- a/packages/api-extractor/config/api-extractor.json +++ b/packages/api-extractor/config/api-extractor.json @@ -5,12 +5,12 @@ "apiReport": { "enabled": true, - "reportFolder": "../../../common/reviews/api" + "reportFolder": "/docs/review" }, "docModel": { "enabled": true, - "apiJsonFilePath": "../../../common/temp/api/.api.json" + "apiJsonFilePath": "/docs/.api.json" }, "dtsRollup": { diff --git a/packages/api-extractor/src/collector/Collector.ts b/packages/api-extractor/src/collector/Collector.ts index 278b65edf..11dcf1861 100644 --- a/packages/api-extractor/src/collector/Collector.ts +++ b/packages/api-extractor/src/collector/Collector.ts @@ -4,7 +4,7 @@ import { ReleaseTag } from '@discordjs/api-extractor-model'; import * as tsdoc from '@microsoft/tsdoc'; import { PackageJsonLookup, Sort, InternalError } from '@rushstack/node-core-library'; -import * as ts from 'typescript'; +import ts from 'typescript'; import { PackageDocComment } from '../aedoc/PackageDocComment.js'; import type { AstDeclaration } from '../analyzer/AstDeclaration.js'; import type { AstEntity } from '../analyzer/AstEntity.js'; diff --git a/packages/api-extractor/src/generators/ApiModelGenerator.ts b/packages/api-extractor/src/generators/ApiModelGenerator.ts index dc2d0b012..8863391a5 100644 --- a/packages/api-extractor/src/generators/ApiModelGenerator.ts +++ b/packages/api-extractor/src/generators/ApiModelGenerator.ts @@ -36,7 +36,6 @@ import { Navigation, } from '@discordjs/api-extractor-model'; import type * as tsdoc from '@microsoft/tsdoc'; -import { TSDocParser } from '@microsoft/tsdoc'; import { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference.js'; import { JsonFile, Path } from '@rushstack/node-core-library'; import * as ts from 'typescript'; @@ -220,12 +219,16 @@ export class ApiModelGenerator { private readonly _apiModel: ApiModel; + private readonly _tsDocParser: tsdoc.TSDocParser; + private readonly _referenceGenerator: DeclarationReferenceGenerator; public constructor(collector: Collector) { this._collector = collector; this._apiModel = new ApiModel(); this._referenceGenerator = new DeclarationReferenceGenerator(collector); + // @ts-expect-error we reuse the private tsdocParser from collector here + this._tsDocParser = collector._tsdocParser; } public get apiModel(): ApiModel { @@ -500,7 +503,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = parent?.construct - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/*+\n * ${fixLinkTags(parent.construct.description)}\n${ parent.construct.params ?.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`) @@ -586,7 +589,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${jsDoc.see?.map((see) => ` * @see ${see}\n`).join('') ?? ''}${ jsDoc.deprecated ? ` * @deprecated ${ @@ -658,7 +661,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = parent?.construct - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/*+\n * ${fixLinkTags(parent.construct.description)}\n${ parent.construct.params ?.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`) @@ -789,7 +792,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${ jsDoc.params?.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`).join('') ?? '' @@ -916,7 +919,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${jsDoc.see?.map((see) => ` * @see ${see}\n`).join('') ?? ''}${ jsDoc.deprecated ? ` * @deprecated ${ @@ -980,7 +983,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${ jsDoc.params?.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`).join('') ?? '' @@ -1058,7 +1061,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${ jsDoc.params?.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`).join('') ?? '' @@ -1166,7 +1169,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${ 'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : '' }${'readonly' in jsDoc && jsDoc.readonly ? ' * @readonly\n' : ''}${ @@ -1229,7 +1232,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${ 'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : '' }${'readonly' in jsDoc && jsDoc.readonly ? ' * @readonly\n' : ''}${ @@ -1290,7 +1293,7 @@ export class ApiModelGenerator { const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture); const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration); const docComment: tsdoc.DocComment | undefined = jsDoc - ? new TSDocParser().parseString( + ? this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description) ?? ''}\n${ 'params' in jsDoc ? jsDoc.params.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`).join('') @@ -1425,7 +1428,7 @@ export class ApiModelGenerator { }); } - const docComment: tsdoc.DocComment | undefined = new TSDocParser().parseString( + const docComment: tsdoc.DocComment | undefined = this._tsDocParser.parseString( `/**\n * ${fixLinkTags(jsDoc.description)}\n${ jsDoc.params?.map((param) => ` * @param ${param.name} - ${fixLinkTags(param.description)}\n`).join('') ?? '' }${'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : ''}${ diff --git a/packages/api-extractor/src/generators/ExcerptBuilder.ts b/packages/api-extractor/src/generators/ExcerptBuilder.ts index da6b0fd69..c991b2adb 100644 --- a/packages/api-extractor/src/generators/ExcerptBuilder.ts +++ b/packages/api-extractor/src/generators/ExcerptBuilder.ts @@ -135,7 +135,7 @@ export class ExcerptBuilder { return { startIndex: 0, endIndex: 0, typeParameters: [] }; } - public static isPrimitiveKeyword(node: ts.Node): boolean { + private static _isPrimitiveKeyword(node: ts.Node): boolean { switch (node.kind) { case ts.SyntaxKind.AnyKeyword: case ts.SyntaxKind.BigIntKeyword: @@ -156,6 +156,15 @@ export class ExcerptBuilder { } } + private static _isRedundantBarAfterColon(span: Span) { + return ( + span.kind === ts.SyntaxKind.BarToken && + span.previousSibling === undefined && + (span.parent?.parent?.previousSibling?.kind === ts.SyntaxKind.LessThanToken || + span.parent?.parent?.previousSibling?.kind === ts.SyntaxKind.ColonToken) + ); + } + private static _buildSpan(excerptTokens: IExcerptToken[], span: Span, state: IBuildSpanState): boolean { if (span.kind === ts.SyntaxKind.JSDocComment) { // Discard any comments @@ -174,21 +183,21 @@ export class ExcerptBuilder { if (span.prefix) { let canonicalReference: DeclarationReference | undefined; - if (span.kind === ts.SyntaxKind.Identifier) { - const name: ts.Identifier = span.node as ts.Identifier; + if (ts.isIdentifier(span.node)) { + const name: ts.Identifier = span.node; canonicalReference = state.referenceGenerator.getDeclarationReferenceForIdentifier(name); } if (canonicalReference) { ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Reference, span.prefix, canonicalReference); } else if ( - ExcerptBuilder.isPrimitiveKeyword(span.node) || - (span.node.kind === ts.SyntaxKind.Identifier && + ExcerptBuilder._isPrimitiveKeyword(span.node) || + (ts.isIdentifier(span.node) && ((ts.isTypeReferenceNode(span.node.parent) && span.node.parent.typeName === span.node) || (ts.isTypeParameterDeclaration(span.node.parent) && span.node.parent.name === span.node))) ) { ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Reference, span.prefix); - } else { + } else if (!ExcerptBuilder._isRedundantBarAfterColon(span)) { ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Content, span.prefix); } @@ -313,6 +322,12 @@ export class ExcerptBuilder { !startOrEndIndices.has(currentIndex) ) { prevToken.text += currentToken.text; + // Remove BarTokens from excerpts if they immediately follow a LessThanToken, e.g. `Promise< | Something>` + // would become `Promise` + if (/<\s*\|/.test(prevToken.text)) { + prevToken.text = prevToken.text.replace(/<\s*\|\s*/, '<'); + } + mergeCount = 1; } else { // Otherwise, no merging can occur here. Continue to the next index. diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index ed748734d..5a4c8e224 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -991,7 +991,7 @@ export class Client extends BaseClient { public fetchVoiceRegions(): Promise>; public fetchSticker(id: Snowflake): Promise; public fetchStickerPacks(): Promise>; - /** @deprecated Use {@link fetchStickerPacks} instead. */ + /** @deprecated Use {@link Client#fetchStickerPacks} instead. */ public fetchPremiumStickerPacks(): ReturnType; public fetchWebhook(id: Snowflake, token?: string): Promise; public fetchGuildWidget(guild: GuildResolvable): Promise; @@ -1870,7 +1870,7 @@ export class BaseInteraction extends Base public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction; public isModalSubmit(): this is ModalSubmitInteraction; public isUserContextMenuCommand(): this is UserContextMenuCommandInteraction; - /** @deprecated Use {@link isStringSelectMenu} instead. */ + /** @deprecated Use {@link BaseInteraction#isStringSelectMenu} instead. */ public isSelectMenu(): this is StringSelectMenuInteraction; public isAnySelectMenu(): this is AnySelectMenuInteraction; public isStringSelectMenu(): this is StringSelectMenuInteraction; @@ -1957,12 +1957,12 @@ export class Invite extends Base { public toJSON(): unknown; public toString(): string; public static InvitesPattern: RegExp; - /** @deprecated */ + /** @deprecated Public Stage Instances don't exist anymore */ public stageInstance: InviteStageInstance | null; public guildScheduledEvent: GuildScheduledEvent | null; } -/** @deprecated */ +/** @deprecated Public Stage Instances don't exist anymore */ export class InviteStageInstance extends Base { private constructor(client: Client, data: RawInviteStageInstance, channelId: Snowflake, guildId: Snowflake); public channelId: Snowflake; @@ -3065,7 +3065,7 @@ export class TeamMember extends Base { private constructor(team: Team, data: RawTeamMemberData); public team: Team; public get id(): Snowflake; - /** @deprecated Use {@link role} instead. */ + /** @deprecated Use {@link TeamMember#role} instead. */ public permissions: string[]; public membershipState: TeamMemberMembershipState; public user: User; @@ -3632,24 +3632,24 @@ export enum DiscordjsErrorCodes { TokenMissing = 'TokenMissing', ApplicationCommandPermissionsTokenMissing = 'ApplicationCommandPermissionsTokenMissing', - /** @deprecated */ + /** @deprecated WebSocket errors are now handled in `@discordjs/ws` */ WSCloseRequested = 'WSCloseRequested', - /** @deprecated */ + /** @deprecated WebSocket errors are now handled in `@discordjs/ws` */ WSConnectionExists = 'WSConnectionExists', - /** @deprecated */ + /** @deprecated WebSocket errors are now handled in `@discordjs/ws` */ WSNotOpen = 'WSNotOpen', - /** @deprecated */ + /** @deprecated No longer in use */ ManagerDestroyed = 'ManagerDestroyed', BitFieldInvalid = 'BitFieldInvalid', - /** @deprecated */ + /** @deprecated This error is now handled in `@discordjs/ws` */ ShardingInvalid = 'ShardingInvalid', - /** @deprecated */ + /** @deprecated This error is now handled in `@discordjs/ws` */ ShardingRequired = 'ShardingRequired', - /** @deprecated */ + /** @deprecated This error is now handled in `@discordjs/ws` */ InvalidIntents = 'InvalidIntents', - /** @deprecated */ + /** @deprecated This error is now handled in `@discordjs/ws` */ DisallowedIntents = 'DisallowedIntents', ShardingNoShards = 'ShardingNoShards', ShardingInProcess = 'ShardingInProcess', @@ -3669,29 +3669,29 @@ export enum DiscordjsErrorCodes { InviteOptionsMissingChannel = 'InviteOptionsMissingChannel', - /** @deprecated */ + /** @deprecated Button validation errors are now handled in `@discordjs/builders` */ ButtonLabel = 'ButtonLabel', - /** @deprecated */ + /** @deprecated Button validation errors are now handled in `@discordjs/builders` */ ButtonURL = 'ButtonURL', - /** @deprecated */ + /** @deprecated Button validation errors are now handled in `@discordjs/builders` */ ButtonCustomId = 'ButtonCustomId', - /** @deprecated */ + /** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */ SelectMenuCustomId = 'SelectMenuCustomId', - /** @deprecated */ + /** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */ SelectMenuPlaceholder = 'SelectMenuPlaceholder', - /** @deprecated */ + /** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */ SelectOptionLabel = 'SelectOptionLabel', - /** @deprecated */ + /** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */ SelectOptionValue = 'SelectOptionValue', - /** @deprecated */ + /** @deprecated Select Menu validation errors are now handled in `@discordjs/builders` */ SelectOptionDescription = 'SelectOptionDescription', InteractionCollectorError = 'InteractionCollectorError', FileNotFound = 'FileNotFound', - /** @deprecated */ + /** @deprecated No longer in use */ UserBannerNotFetched = 'UserBannerNotFetched', UserNoDMChannel = 'UserNoDMChannel', @@ -3702,16 +3702,16 @@ export enum DiscordjsErrorCodes { ReqResourceType = 'ReqResourceType', - /** @deprecated */ + /** @deprecated This error is now handled in `@discordjs/rest` */ ImageFormat = 'ImageFormat', - /** @deprecated */ + /** @deprecated This error is now handled in `@discordjs/rest` */ ImageSize = 'ImageSize', MessageBulkDeleteType = 'MessageBulkDeleteType', MessageNonceType = 'MessageNonceType', MessageContentType = 'MessageContentType', - /** @deprecated */ + /** @deprecated No longer in use */ SplitMaxLen = 'SplitMaxLen', BanResolveId = 'BanResolveId', @@ -3747,14 +3747,14 @@ export enum DiscordjsErrorCodes { EmojiType = 'EmojiType', EmojiManaged = 'EmojiManaged', MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission', - /** @deprecated Use {@link MissingManageGuildExpressionsPermission} instead. */ + /** @deprecated Use {@link DiscordjsErrorCodes.MissingManageGuildExpressionsPermission} instead. */ MissingManageEmojisAndStickersPermission = 'MissingManageEmojisAndStickersPermission', NotGuildSticker = 'NotGuildSticker', ReactionResolveUser = 'ReactionResolveUser', - /** @deprecated */ + /** @deprecated Not used anymore since the introduction of `GUILD_WEB_PAGE_VANITY_URL` feature */ VanityURL = 'VanityURL', InviteResolveCode = 'InviteResolveCode', @@ -3771,7 +3771,7 @@ export enum DiscordjsErrorCodes { InteractionAlreadyReplied = 'InteractionAlreadyReplied', InteractionNotReplied = 'InteractionNotReplied', - /** @deprecated */ + /** @deprecated Not used anymore since ephemeral replies can now be deleted */ InteractionEphemeralReplied = 'InteractionEphemeralReplied', CommandInteractionOptionNotFound = 'CommandInteractionOptionNotFound', @@ -4801,7 +4801,7 @@ export interface AwaitReactionsOptions extends ReactionCollectorOptions { } export interface BanOptions { - /** @deprecated Use {@link deleteMessageSeconds} instead. */ + /** @deprecated Use {@link BanOptions#deleteMessageSeconds} instead. */ deleteMessageDays?: number; deleteMessageSeconds?: number; reason?: string; @@ -5001,7 +5001,7 @@ export interface ClientEvents { typingStart: [typing: Typing]; userUpdate: [oldUser: User | PartialUser, newUser: User]; voiceStateUpdate: [oldState: VoiceState, newState: VoiceState]; - /** @deprecated Use {@link webhooksUpdate} instead. */ + /** @deprecated Use {@link ClientEvents#webhooksUpdate} instead. */ webhookUpdate: ClientEvents['webhooksUpdate']; webhooksUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel]; interactionCreate: [interaction: Interaction]; @@ -5061,10 +5061,10 @@ export interface ClientUserEditOptions { } export interface CloseEvent { - /** @deprecated */ + /** @deprecated Not used anymore since using {@link @discordjs/ws#WebSocketManager} internally */ wasClean: boolean; code: number; - /** @deprecated */ + /** @deprecated Not used anymore since using {@link @discordjs/ws#WebSocketManager} internally */ reason: string; } @@ -5390,11 +5390,11 @@ export interface FetchGuildScheduledEventSubscribersOptions { withMember?: boolean; } -interface FetchInviteOptions extends BaseFetchOptions { +export interface FetchInviteOptions extends BaseFetchOptions { code: string; } -interface FetchInvitesOptions { +export interface FetchInvitesOptions { channelId?: GuildInvitableChannelResolvable; cache?: boolean; }