From 8028813825e7708915ea892760c1003afd60df2f Mon Sep 17 00:00:00 2001 From: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com> Date: Fri, 19 Aug 2022 12:24:55 -0400 Subject: [PATCH] feat(website): render `@defaultValue` blocks (#8527) feat(website): render @defaultValue blocks --- packages/rest/src/lib/CDN.ts | 4 +-- packages/rest/src/lib/REST.ts | 30 +++++++++---------- packages/rest/src/lib/RequestManager.ts | 6 ++-- .../src/components/tsdoc/BlockComment.tsx | 6 ++++ packages/ws/src/ws/WebSocketManager.ts | 8 ++--- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/packages/rest/src/lib/CDN.ts b/packages/rest/src/lib/CDN.ts index 3f03c1aa51be..0385adc03d4d 100644 --- a/packages/rest/src/lib/CDN.ts +++ b/packages/rest/src/lib/CDN.ts @@ -15,7 +15,7 @@ export interface BaseImageURLOptions { /** * The extension to use for the image URL * - * @default 'webp' + * @defaultValue `'webp'` */ extension?: ImageExtension; /** @@ -41,7 +41,7 @@ export interface MakeURLOptions { /** * The extension to use for the image URL * - * @default 'webp' + * @defaultValue `'webp'` */ extension?: string | undefined; /** diff --git a/packages/rest/src/lib/REST.ts b/packages/rest/src/lib/REST.ts index d7ffadd26d73..356b077e2594 100644 --- a/packages/rest/src/lib/REST.ts +++ b/packages/rest/src/lib/REST.ts @@ -25,45 +25,45 @@ export interface RESTOptions { agent: Dispatcher; /** * The base api path, without version - * @default 'https://discord.com/api' + * @defaultValue `'https://discord.com/api'` */ api: string; /** * The authorization prefix to use for requests, useful if you want to use * bearer tokens * - * @default 'Bot' + * @defaultValue `'Bot'` */ authPrefix: 'Bot' | 'Bearer'; /** * The cdn path * - * @default 'https://cdn.discordapp.com' + * @defaultValue 'https://cdn.discordapp.com' */ cdn: string; /** * Additional headers to send for all API requests * - * @default {} + * @defaultValue `{}` */ headers: Record; /** * The number of invalid REST requests (those that return 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings). * That is, if set to 500, warnings will be emitted at invalid request number 500, 1000, 1500, and so on. * - * @default 0 + * @defaultValue `0` */ invalidRequestWarningInterval: number; /** * How many requests to allow sending per second (Infinity for unlimited, 50 for the standard global limit used by Discord) * - * @default 50 + * @defaultValue `50` */ globalRequestsPerSecond: number; /** * The extra offset to add to rate limits in milliseconds * - * @default 50 + * @defaultValue `50` */ offset: number; /** @@ -72,50 +72,50 @@ export interface RESTOptions { * (e.g. `/channels` to match any route starting with `/channels` such as `/channels/:id/messages`) * for which to throw {@link RateLimitError}s. All other request routes will be queued normally * - * @default null + * @defaultValue `null` */ rejectOnRateLimit: string[] | RateLimitQueueFilter | null; /** * The number of retries for errors with the 500 code, or errors * that timeout * - * @default 3 + * @defaultValue `3` */ retries: number; /** * The time to wait in milliseconds before a request is aborted * - * @default 15_000 + * @defaultValue `15_000` */ timeout: number; /** * Extra information to add to the user agent * - * @default `Node.js ${process.version}` + * @defaultValue ``Node.js ${process.version}`` */ userAgentAppendix: string; /** * The version of the API to use * - * @default '10' + * @defaultValue `'10'` */ version: string; /** * The amount of time in milliseconds that passes between each hash sweep. (defaults to 4h) * - * @default 14_400_000 + * @defaultValue `14_400_000` */ hashSweepInterval: number; /** * The maximum amount of time a hash can exist in milliseconds without being hit with a request (defaults to 24h) * - * @default 86_400_000 + * @defaultValue `86_400_000` */ hashLifetime: number; /** * The amount of time in milliseconds that passes between each hash sweep. (defaults to 1h) * - * @default 3_600_000 + * @defaultValue `3_600_000` */ handlerSweepInterval: number; } diff --git a/packages/rest/src/lib/RequestManager.ts b/packages/rest/src/lib/RequestManager.ts index bdc0364b22f3..52ef3a0c0053 100644 --- a/packages/rest/src/lib/RequestManager.ts +++ b/packages/rest/src/lib/RequestManager.ts @@ -50,13 +50,13 @@ export interface RequestData { /** * If this request needs the `Authorization` header * - * @default true + * @defaultValue `true` */ auth?: boolean; /** * The authorization prefix to use for this request, useful if you use this with bearer tokens * - * @default 'Bot' + * @defaultValue `'Bot'` */ authPrefix?: 'Bot' | 'Bearer'; /** @@ -92,7 +92,7 @@ export interface RequestData { /** * If this request should be versioned * - * @default true + * @defaultValue `true` */ versioned?: boolean; } diff --git a/packages/website/src/components/tsdoc/BlockComment.tsx b/packages/website/src/components/tsdoc/BlockComment.tsx index e8201a33b082..373cb13edf8f 100644 --- a/packages/website/src/components/tsdoc/BlockComment.tsx +++ b/packages/website/src/components/tsdoc/BlockComment.tsx @@ -40,6 +40,10 @@ export function DeprecatedBlock({ children }: { children: ReactNode }): JSX.Elem ); } +export function DefaultValueBlock({ children }: { children: ReactNode }): JSX.Element { + return {children}; +} + export function RemarksBlock({ children }: { children: ReactNode }): JSX.Element { return {children}; } @@ -52,6 +56,8 @@ export function BlockComment({ children, tagName, index }: BlockCommentProps): J return {children}; case StandardTags.remarks.tagNameWithUpperCase: return {children}; + case StandardTags.defaultValue.tagNameWithUpperCase: + return {children}; case StandardTags.typeParam.tagNameWithUpperCase: case StandardTags.param.tagNameWithUpperCase: return {children}; diff --git a/packages/ws/src/ws/WebSocketManager.ts b/packages/ws/src/ws/WebSocketManager.ts index 3d75c6e9bbc0..52a28ce5ba37 100644 --- a/packages/ws/src/ws/WebSocketManager.ts +++ b/packages/ws/src/ws/WebSocketManager.ts @@ -112,17 +112,17 @@ export interface OptionalWebSocketManagerOptions { identifyProperties: GatewayIdentifyProperties; /** * The gateway version to use - * @default '10' + * @defaultValue `'10'` */ version: string; /** * The encoding to use - * @default 'json' + * @defaultValue `'json'` */ encoding: Encoding; /** * The compression method to use - * @default null (no compression) + * @defaultValue `null` (no compression) */ compression: CompressionMethod | null; /** @@ -187,7 +187,7 @@ export class WebSocketManager extends AsyncEventEmitter { /** * Strategy used to manage shards - * @default SimpleManagerToShardStrategy + * @defaultValue `SimpleManagerToShardStrategy` */ private strategy: IShardingStrategy = new SimpleShardingStrategy(this);