From 9193f2df21f5bd560e5a7eeea155218b8821ca1f Mon Sep 17 00:00:00 2001 From: almeidx Date: Tue, 13 Feb 2024 11:29:08 +0000 Subject: [PATCH] refactor: remove usage of mixin on error classes --- packages/discord.js/typings/index.d.ts | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 51520b653bca..2ce5f59657d1 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3915,23 +3915,23 @@ export enum DiscordjsErrorCodes { EntitlementCreateInvalidOwner = 'EntitlementCreateInvalidOwner', } -/** @internal */ -export interface DiscordjsErrorFields { - readonly name: `${Name} [${DiscordjsErrorCodes}]`; - get code(): DiscordjsErrorCodes; +export class DiscordjsError extends Error { + private constructor(code: DiscordjsErrorCodes, ...args: unknown[]); + public readonly code: DiscordjsErrorCodes; + public get name(): `Error [${DiscordjsErrorCodes}]`; } -/** @internal */ -export function DiscordjsErrorMixin( - Base: Constructable, - name: Name, -): Constructable>; - -export class DiscordjsError extends DiscordjsErrorMixin(Error, 'Error') {} - -export class DiscordjsTypeError extends DiscordjsErrorMixin(TypeError, 'TypeError') {} +export class DiscordjsTypeError extends TypeError { + private constructor(code: DiscordjsErrorCodes, ...args: unknown[]); + public readonly code: DiscordjsErrorCodes; + public get name(): `TypeError [${DiscordjsErrorCodes}]`; +} -export class DiscordjsRangeError extends DiscordjsErrorMixin(RangeError, 'RangeError') {} +export class DiscordjsRangeError extends RangeError { + private constructor(code: DiscordjsErrorCodes, ...args: unknown[]); + public readonly code: DiscordjsErrorCodes; + public get name(): `RangeError [${DiscordjsErrorCodes}]`; +} //#endregion