diff --git a/packages/collection/src/collection.ts b/packages/collection/src/collection.ts index eb955b74aea1..c8a14cdea52f 100644 --- a/packages/collection/src/collection.ts +++ b/packages/collection/src/collection.ts @@ -230,13 +230,13 @@ export class Collection extends Map { * ``` */ public find(fn: (value: V, key: K, collection: this) => value is V2): V2 | undefined; - public find(fn: (value: V, key: K, collection: this) => boolean): V | undefined; + public find(fn: (value: V, key: K, collection: this) => unknown): V | undefined; public find( fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This, ): V2 | undefined; - public find(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): V | undefined; - public find(fn: (value: V, key: K, collection: this) => boolean, thisArg?: unknown): V | undefined { + public find(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): V | undefined; + public find(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): V | undefined { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg); for (const [key, val] of this) { @@ -259,13 +259,13 @@ export class Collection extends Map { * ``` */ public findKey(fn: (value: V, key: K, collection: this) => key is K2): K2 | undefined; - public findKey(fn: (value: V, key: K, collection: this) => boolean): K | undefined; + public findKey(fn: (value: V, key: K, collection: this) => unknown): K | undefined; public findKey( fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This, ): K2 | undefined; - public findKey(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): K | undefined; - public findKey(fn: (value: V, key: K, collection: this) => boolean, thisArg?: unknown): K | undefined { + public findKey(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): K | undefined; + public findKey(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): K | undefined { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg); for (const [key, val] of this) { @@ -282,9 +282,9 @@ export class Collection extends Map { * @param thisArg - Value to use as `this` when executing function * @returns The number of removed entries */ - public sweep(fn: (value: V, key: K, collection: this) => boolean): number; - public sweep(fn: (this: T, value: V, key: K, collection: this) => boolean, thisArg: T): number; - public sweep(fn: (value: V, key: K, collection: this) => boolean, thisArg?: unknown): number { + public sweep(fn: (value: V, key: K, collection: this) => unknown): number; + public sweep(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): number; + public sweep(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): number { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg); const previousSize = this.size; @@ -309,7 +309,7 @@ export class Collection extends Map { */ public filter(fn: (value: V, key: K, collection: this) => key is K2): Collection; public filter(fn: (value: V, key: K, collection: this) => value is V2): Collection; - public filter(fn: (value: V, key: K, collection: this) => boolean): Collection; + public filter(fn: (value: V, key: K, collection: this) => unknown): Collection; public filter( fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This, @@ -318,8 +318,8 @@ export class Collection extends Map { fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This, ): Collection; - public filter(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): Collection; - public filter(fn: (value: V, key: K, collection: this) => boolean, thisArg?: unknown): Collection { + public filter(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): Collection; + public filter(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): Collection { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg); const results = new this.constructor[Symbol.species](); @@ -347,7 +347,7 @@ export class Collection extends Map { public partition( fn: (value: V, key: K, collection: this) => value is V2, ): [Collection, Collection>]; - public partition(fn: (value: V, key: K, collection: this) => boolean): [Collection, Collection]; + public partition(fn: (value: V, key: K, collection: this) => unknown): [Collection, Collection]; public partition( fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This, @@ -357,11 +357,11 @@ export class Collection extends Map { thisArg: This, ): [Collection, Collection>]; public partition( - fn: (this: This, value: V, key: K, collection: this) => boolean, + fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This, ): [Collection, Collection]; public partition( - fn: (value: V, key: K, collection: this) => boolean, + fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown, ): [Collection, Collection] { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); @@ -458,9 +458,9 @@ export class Collection extends Map { * collection.some(user => user.discriminator === '0000'); * ``` */ - public some(fn: (value: V, key: K, collection: this) => boolean): boolean; - public some(fn: (this: T, value: V, key: K, collection: this) => boolean, thisArg: T): boolean; - public some(fn: (value: V, key: K, collection: this) => boolean, thisArg?: unknown): boolean { + public some(fn: (value: V, key: K, collection: this) => unknown): boolean; + public some(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): boolean; + public some(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): boolean { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg); for (const [key, val] of this) { @@ -483,7 +483,7 @@ export class Collection extends Map { */ public every(fn: (value: V, key: K, collection: this) => key is K2): this is Collection; public every(fn: (value: V, key: K, collection: this) => value is V2): this is Collection; - public every(fn: (value: V, key: K, collection: this) => boolean): boolean; + public every(fn: (value: V, key: K, collection: this) => unknown): boolean; public every( fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This, @@ -492,8 +492,8 @@ export class Collection extends Map { fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This, ): this is Collection; - public every(fn: (this: This, value: V, key: K, collection: this) => boolean, thisArg: This): boolean; - public every(fn: (value: V, key: K, collection: this) => boolean, thisArg?: unknown): boolean { + public every(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): boolean; + public every(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): boolean { if (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`); if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg); for (const [key, val] of this) {