Typescript Error 'typeof Client' incorrectly extends base class

Node v20.16.0
djs v14.16.3
TS v5.6.3
Node v20.16.0
djs v14.16.3
TS v5.6.3
Hi! Recently updated some packages and started running into this ts build error:
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>'.

986 export class Client<Ready extends boolean = boolean> extends BaseClient {
~~~~~~

node_modules/typescript/lib/lib.esnext.disposable.d.ts:40:5
40 [Symbol.asyncDispose](): PromiseLike<void>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'[Symbol.asyncDispose]' is declared here.
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>'.

986 export class Client<Ready extends boolean = boolean> extends BaseClient {
~~~~~~

node_modules/typescript/lib/lib.esnext.disposable.d.ts:40:5
40 [Symbol.asyncDispose](): PromiseLike<void>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'[Symbol.asyncDispose]' is declared here.
Packages list: ├── @types/[email protected] ├── @types/[email protected] ├── @types/[email protected] ├── @types/[email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] └── [email protected]
4 Replies
d.js toolkit
d.js toolkit2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
MattTheWaz
MattTheWazOP2mo ago
In case it is relevant, my tsconfig is pretty simple:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "nodenext",
"outDir": "dist",
"sourceMap": true,
"strict": true
},
"include": ["src/**/*"]
}
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "nodenext",
"outDir": "dist",
"sourceMap": true,
"strict": true
},
"include": ["src/**/*"]
}
Well, I jumped forward from typescript 5.2.0-dev.20230804; it being a weird dev build was one of the reasons I updated. I'll try reverting to those other versions and get back to you Looks like 5.5 works. Now I just gotta typeguard my message.channel.sends
d.js docs
d.js docs2mo ago
:method: GuildChannel#isSendable() @14.16.3 Indicates whether this channel is sendable.
MattTheWaz
MattTheWazOP2mo ago
Let me check. The method I am using this in has the param specified as a TextBasedChannel, since that's what I was getting at the time So maybe I just need to update the param type Getting it from an interaction Still looks like a TextBasedChannel type Sorry, I was mixing two seperate examples. In one example, it's an interaction.channel, in the other it's a message coming from a messagecreate event Most of my bot has been updated to use slash commands, but I still have some that just read chat Either way, I'll be using that isSendable() Thank you for your help And bots don't get permission to send messages in GroupDMs? I assume 👍🏻 Again, I appreciate your help I thought I had, but I can double check later Thanks for the follow-up
Want results from more Discord servers?
Add your server