discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

types(collection): simplify ambient constructor declaration

Open Renegade334 opened this issue 4 months ago • 1 comments

collection.ts needs an ambient declaration for Collection.prototype.constructor in order for the TypeScript compiler to understand this.constructor[Symbol.species] references within class methods.

The existing implementation of this is a little clumsy. This refactor simplifies the declaration significantly, and also removes the risk of the constructor property type becoming out-of-sync with Collection if changes are made to the constructor.

Removes the redundant CollectionConstructor interface which, although exported, is marked @internal and doesn't appear in the docs, therefore should probably be OK to count as a non-breaking change.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Renegade334 avatar Oct 11 '24 00:10 Renegade334