mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
feat: external collection package (#2934)
* Use external collection package * Complete typings * Document properly base collection class * Add clone since sort is now in-place * Update for latest changes to package * Fix whitespace * Update docs link * Oops * Update Collection.js * Update index.d.ts
This commit is contained in:
35
typings/index.d.ts
vendored
35
typings/index.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
declare module 'discord.js' {
|
||||
import BaseCollection from '@discord.js/collection';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Stream, Readable, Writable } from 'stream';
|
||||
import { ChildProcess } from 'child_process';
|
||||
@@ -311,39 +312,7 @@ declare module 'discord.js' {
|
||||
public setUsername(username: string): Promise<ClientUser>;
|
||||
}
|
||||
|
||||
export class Collection<K, V> extends Map<K, V> {
|
||||
private _array: V[];
|
||||
private _keyArray: K[];
|
||||
|
||||
public array(): V[];
|
||||
public clone(): Collection<K, V>;
|
||||
public concat(...collections: Collection<K, V>[]): Collection<K, V>;
|
||||
public each(fn: (value: V, key: K, collection: Collection<K, V>) => void, thisArg?: any): Collection<K, V>;
|
||||
public equals(collection: Collection<any, any>): boolean;
|
||||
public every(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): boolean;
|
||||
public filter(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): Collection<K, V>;
|
||||
public find(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): V | undefined;
|
||||
public findKey(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): K | undefined;
|
||||
public first(): V | undefined;
|
||||
public first(count: number): V[];
|
||||
public firstKey(): K | undefined;
|
||||
public firstKey(count: number): K[];
|
||||
public keyArray(): K[];
|
||||
public last(): V | undefined;
|
||||
public last(count: number): V[];
|
||||
public lastKey(): K | undefined;
|
||||
public lastKey(count: number): K[];
|
||||
public map<T>(fn: (value: V, key: K, collection: Collection<K, V>) => T, thisArg?: any): T[];
|
||||
public partition(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): [Collection<K, V>, Collection<K, V>];
|
||||
public random(): V | undefined;
|
||||
public random(count: number): V[];
|
||||
public randomKey(): K | undefined;
|
||||
public randomKey(count: number): K[];
|
||||
public reduce<T>(fn: (accumulator: T, value: V, key: K, collection: Collection<K, V>) => T, initialValue?: T): T;
|
||||
public some(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): boolean;
|
||||
public sort(compareFunction?: (a: V, b: V, c?: K, d?: K) => number): Collection<K, V>;
|
||||
public sweep(fn: (value: V, key: K, collection: Collection<K, V>) => boolean, thisArg?: any): number;
|
||||
public tap(fn: (collection: Collection<K, V>) => void, thisArg?: any): Collection<K, V>;
|
||||
export class Collection<K, V> extends BaseCollection<K, V> {
|
||||
public toJSON(): object;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user