mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
refactor(Util): make class extend null (#6000)
This commit is contained in:
@@ -11,11 +11,7 @@ const Invite = require('../structures/Invite');
|
|||||||
* The DataResolver identifies different objects and tries to resolve a specific piece of information from them.
|
* The DataResolver identifies different objects and tries to resolve a specific piece of information from them.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
class DataResolver {
|
class DataResolver extends null {
|
||||||
constructor() {
|
|
||||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data that can be resolved to give an invite code. This can be:
|
* Data that can be resolved to give an invite code. This can be:
|
||||||
* * An invite code
|
* * An invite code
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ let INCREMENT = 0;
|
|||||||
/**
|
/**
|
||||||
* A container for useful snowflake-related methods.
|
* A container for useful snowflake-related methods.
|
||||||
*/
|
*/
|
||||||
class SnowflakeUtil {
|
class SnowflakeUtil extends null {
|
||||||
constructor() {
|
|
||||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
||||||
* ```
|
* ```
|
||||||
|
|||||||
@@ -31,11 +31,7 @@
|
|||||||
/**
|
/**
|
||||||
* Allows for the extension of built-in Discord.js structures that are instantiated by {@link BaseManager Managers}.
|
* Allows for the extension of built-in Discord.js structures that are instantiated by {@link BaseManager Managers}.
|
||||||
*/
|
*/
|
||||||
class Structures {
|
class Structures extends null {
|
||||||
constructor() {
|
|
||||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a structure class.
|
* Retrieves a structure class.
|
||||||
* @param {string} structure Name of the structure to retrieve
|
* @param {string} structure Name of the structure to retrieve
|
||||||
|
|||||||
@@ -10,11 +10,7 @@ const isObject = d => typeof d === 'object' && d !== null;
|
|||||||
/**
|
/**
|
||||||
* Contains various general-purpose utility methods.
|
* Contains various general-purpose utility methods.
|
||||||
*/
|
*/
|
||||||
class Util {
|
class Util extends null {
|
||||||
constructor() {
|
|
||||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flatten an object. Any properties that are collections will get converted to an array of keys.
|
* Flatten an object. Any properties that are collections will get converted to an array of keys.
|
||||||
* @param {Object} obj The object to flatten.
|
* @param {Object} obj The object to flatten.
|
||||||
|
|||||||
12
typings/index.d.ts
vendored
12
typings/index.d.ts
vendored
@@ -812,7 +812,8 @@ declare module 'discord.js' {
|
|||||||
PremiumTiers: typeof PremiumTiers;
|
PremiumTiers: typeof PremiumTiers;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class DataResolver {
|
export class DataResolver extends null {
|
||||||
|
private constructor();
|
||||||
public static resolveBase64(data: Base64Resolvable): string;
|
public static resolveBase64(data: Base64Resolvable): string;
|
||||||
public static resolveCode(data: string, regx: RegExp): string;
|
public static resolveCode(data: string, regx: RegExp): string;
|
||||||
public static resolveFile(resource: BufferResolvable | Stream): Promise<Buffer | Stream>;
|
public static resolveFile(resource: BufferResolvable | Stream): Promise<Buffer | Stream>;
|
||||||
@@ -1855,7 +1856,8 @@ declare module 'discord.js' {
|
|||||||
public once(event: 'shardCreate', listener: (shard: Shard) => Awaited<void>): this;
|
public once(event: 'shardCreate', listener: (shard: Shard) => Awaited<void>): this;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SnowflakeUtil {
|
export class SnowflakeUtil extends null {
|
||||||
|
private constructor();
|
||||||
public static deconstruct(snowflake: Snowflake): DeconstructedSnowflake;
|
public static deconstruct(snowflake: Snowflake): DeconstructedSnowflake;
|
||||||
public static generate(timestamp?: number | Date): Snowflake;
|
public static generate(timestamp?: number | Date): Snowflake;
|
||||||
public static readonly EPOCH: number;
|
public static readonly EPOCH: number;
|
||||||
@@ -1892,7 +1894,8 @@ declare module 'discord.js' {
|
|||||||
public type: 'store';
|
public type: 'store';
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Structures {
|
export class Structures extends null {
|
||||||
|
private constructor();
|
||||||
public static get<K extends keyof Extendable>(structure: K): Extendable[K];
|
public static get<K extends keyof Extendable>(structure: K): Extendable[K];
|
||||||
public static get(structure: string): (...args: any[]) => void;
|
public static get(structure: string): (...args: any[]) => void;
|
||||||
public static extend<K extends keyof Extendable, T extends Extendable[K]>(
|
public static extend<K extends keyof Extendable, T extends Extendable[K]>(
|
||||||
@@ -2052,7 +2055,8 @@ declare module 'discord.js' {
|
|||||||
public static resolve(bit?: BitFieldResolvable<UserFlagsString, number>): number;
|
public static resolve(bit?: BitFieldResolvable<UserFlagsString, number>): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Util {
|
export class Util extends null {
|
||||||
|
private constructor();
|
||||||
public static basename(path: string, ext?: string): string;
|
public static basename(path: string, ext?: string): string;
|
||||||
public static binaryToID(num: string): Snowflake;
|
public static binaryToID(num: string): Snowflake;
|
||||||
public static cleanContent(str: string, channel: Channel): string;
|
public static cleanContent(str: string, channel: Channel): string;
|
||||||
|
|||||||
Reference in New Issue
Block a user