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

After upgrading @types/node to v22.7.9, an incompatible type error occurs in the “on” method of the client class #10577

Open
book000 opened this issue Oct 24, 2024 · 3 comments · May be fixed by #10581

Comments

@book000
Copy link

book000 commented Oct 24, 2024

Which package is this bug report for?

discord.js

Issue description

After upgrading @types/node v22.7.9, the following error occurs when executing the tsc command.

node_modules/.pnpm/[email protected]/node_modules/discord.js/typings/index.d.ts(986,14): error TS2417: Class static side 'typeof Client' incorrectly extends base class static side 'typeof BaseClient'.
The types returned by 'on(...)' are incompatible between these types.
   Property '[Symbol.asyncDispose]' is missing in type 'AsyncIterableIterator<any>' but required in type 'AsyncIterator<any[], any, any>'.

It could be a problem with @types/node, but this type error appears to be occurring in discord.js, so we will raise it here first.

Code sample

https://github.com/jaoafa/discord-new-threads/actions/runs/11490768941/job/31982043563?pr=1179

Versions

  • discord.js v14.16.3
  • Node.js v20.18.0
  • pnpm v9.12.2
  • TypeScript 5.6.3

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

@Renegade334
Copy link
Contributor

Will currently affect builds using the latest @types/node releases in the following circumstances:

  • TS >= 5.6
  • esnext.disposable library loaded
  • skipLibCheck off

Will look at sorting later.

@cobaltt7
Copy link
Contributor

  • esnext.disposable library loaded

I had this same issue, and it was fixed by adding esnext.disposable to my lib. Looking at the linked repo, it looks like they only have esnext.asyncdisposable, which I'm not sure exists.

@book000 Try changing esnext.asyncdisposable to esnext.disposable in your tsconfig.json lib

@book000
Copy link
Author

book000 commented Oct 24, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants