Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: bump @types/node version, use EventEmitter generic #10584

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Qjuh
Copy link
Contributor

@Qjuh Qjuh commented Oct 31, 2024

Please describe the changes this PR makes and why it should be merged:

Bumps @types/node to latest version for the respective node version used in each package but @discordjs/rest, because there's a clash on the types for global fetch() function that needs to be resolved.

Adapts mainlib discord.js typings to use the EventEmitter generic instead of manual overloads for EventEmitter methods.

Supersedes #10581.

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
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@Qjuh Qjuh requested review from a team and iCrawl as code owners October 31, 2024 12:22
Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 0:24am
discord-js-guide ❌ Failed (Inspect) Oct 31, 2024 0:24am

@almeidx almeidx changed the title types(discord.js): bump @types/node version, use EventEmitter generic types: bump @types/node version, use EventEmitter generic Oct 31, 2024
Copy link
Contributor

@Renegade334 Renegade334 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest this should be semver:major, as it will cause new compile errors for downstream projects (in the absence of skipLibCheck) if their installed @types/node version dates from prior to EventEmitter taking a type parameter.

The @types/node patch that allowed for event-mapped returns from top-level node:events functions has had to be reverted, so whether to provide a typed solution for events.on() and events.once() probably still needs to be considered.

@@ -949,7 +952,7 @@ export type If<Value extends boolean, TrueResult, FalseResult = null> = Value ex
? FalseResult
: TrueResult | FalseResult;

export class Client<Ready extends boolean = boolean> extends BaseClient {
export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEvents> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case for Client exposing its own type parameter here, for derived classes to be able to add their own mapped events?

@Qjuh Qjuh marked this pull request as draft October 31, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants