mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: use satisfies where applicable (#8884)
* chore: use satisfies where applicable * chore: remove unneeded eslint ignores Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -34,7 +34,7 @@ export interface BaseBrokerOptions {
|
||||
/**
|
||||
* Default broker options
|
||||
*/
|
||||
export const DefaultBrokerOptions: Required<BaseBrokerOptions> = {
|
||||
export const DefaultBrokerOptions = {
|
||||
name: randomBytes(20).toString('hex'),
|
||||
maxChunk: 10,
|
||||
blockTimeout: 5_000,
|
||||
@@ -43,7 +43,7 @@ export const DefaultBrokerOptions: Required<BaseBrokerOptions> = {
|
||||
return Buffer.from(encoded.buffer, encoded.byteOffset, encoded.byteLength);
|
||||
},
|
||||
decode: (data): unknown => decode(data),
|
||||
};
|
||||
} as const satisfies Required<BaseBrokerOptions>;
|
||||
|
||||
export type ToEventMap<
|
||||
TRecord extends Record<string, any>,
|
||||
|
||||
@@ -21,10 +21,10 @@ export interface RPCRedisBrokerOptions extends RedisBrokerOptions {
|
||||
/**
|
||||
* Default values used for the {@link RPCRedisBrokerOptions}
|
||||
*/
|
||||
export const DefaultRPCRedisBrokerOptions: Required<Omit<RPCRedisBrokerOptions, 'redisClient'>> = {
|
||||
export const DefaultRPCRedisBrokerOptions = {
|
||||
...DefaultBrokerOptions,
|
||||
timeout: 5_000,
|
||||
};
|
||||
} as const satisfies Required<Omit<RPCRedisBrokerOptions, 'redisClient'>>;
|
||||
|
||||
/**
|
||||
* RPC broker powered by Redis
|
||||
|
||||
@@ -415,7 +415,7 @@ export const TimestampStyles = {
|
||||
* Relative time format, consisting of a relative duration format, e.g. 2 months ago
|
||||
*/
|
||||
RelativeTime: 'R',
|
||||
} as const;
|
||||
} as const satisfies Record<string, string>;
|
||||
|
||||
/**
|
||||
* The possible values, see {@link TimestampStyles} for more information
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { RESTOptions } from '../REST.js';
|
||||
|
||||
export const DefaultUserAgent = `DiscordBot (https://discord.js.org, [VI]{{inject}}[/VI])`;
|
||||
|
||||
export const DefaultRestOptions: Required<RESTOptions> = {
|
||||
export const DefaultRestOptions = {
|
||||
get agent() {
|
||||
return new Agent({
|
||||
connect: {
|
||||
@@ -28,7 +28,7 @@ export const DefaultRestOptions: Required<RESTOptions> = {
|
||||
hashSweepInterval: 14_400_000, // 4 Hours
|
||||
hashLifetime: 86_400_000, // 24 Hours
|
||||
handlerSweepInterval: 3_600_000, // 1 Hour
|
||||
};
|
||||
} as const satisfies Required<RESTOptions>;
|
||||
|
||||
/**
|
||||
* The events that the REST manager emits
|
||||
@@ -42,9 +42,9 @@ export const enum RESTEvents {
|
||||
Response = 'response',
|
||||
}
|
||||
|
||||
export const ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'] as const;
|
||||
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json'] as const;
|
||||
export const ALLOWED_SIZES = [16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096] as const;
|
||||
export const ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'] as const satisfies readonly string[];
|
||||
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json'] as const satisfies readonly string[];
|
||||
export const ALLOWED_SIZES = [16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096] as const satisfies readonly number[];
|
||||
|
||||
export type ImageExtension = typeof ALLOWED_EXTENSIONS[number];
|
||||
export type StickerExtension = typeof ALLOWED_STICKER_EXTENSIONS[number];
|
||||
|
||||
@@ -2,7 +2,7 @@ import process from 'node:process';
|
||||
import { Collection } from '@discordjs/collection';
|
||||
import { lazy } from '@discordjs/util';
|
||||
import { APIVersion, GatewayOpcodes } from 'discord-api-types/v10';
|
||||
import type { OptionalWebSocketManagerOptions, SessionInfo } from '../ws/WebSocketManager.js';
|
||||
import type { SessionInfo, OptionalWebSocketManagerOptions } from '../ws/WebSocketManager.js';
|
||||
import type { SendRateLimitState } from '../ws/WebSocketShard.js';
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ const getDefaultSessionStore = lazy(() => new Collection<number, SessionInfo | n
|
||||
/**
|
||||
* Default options used by the manager
|
||||
*/
|
||||
export const DefaultWebSocketManagerOptions: OptionalWebSocketManagerOptions = {
|
||||
export const DefaultWebSocketManagerOptions = {
|
||||
shardCount: null,
|
||||
shardIds: null,
|
||||
largeThreshold: null,
|
||||
@@ -54,7 +54,7 @@ export const DefaultWebSocketManagerOptions: OptionalWebSocketManagerOptions = {
|
||||
handshakeTimeout: 30_000,
|
||||
helloTimeout: 60_000,
|
||||
readyTimeout: 15_000,
|
||||
};
|
||||
} as const satisfies OptionalWebSocketManagerOptions;
|
||||
|
||||
export const ImportantGatewayOpcodes = new Set([
|
||||
GatewayOpcodes.Heartbeat,
|
||||
|
||||
Reference in New Issue
Block a user