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
MessageManager#fetch has signatures, but none of those signatures are compatible with each other. #8545
Comments
I haven’t been able to update since v14.3.0 due to this issue. Can this be fixed asap please? |
I was looking in to this. I initially thought to change Could anyone help point me in the right direction with this? Thanks! |
I am also having the same issue with this. I am currently trying to make a purge command that clears messages from a user, and whenever I try to filter the messages to push them to an array and it filter out the author ID, it gives this error. Even on discord.js v14.7.1. Update: from what it seems, it's probably effecting versions newer than 14.3.0. Downgrading to 14.2.0 fixed it for me, so idk what the hell they did. |
So looks like its effected by #8538 |
prob |
So, I have found the issue. In order to use |
That is not relevant to this issue. If you only care about text channels, you should check the channel's type. |
Either way works, if you check the channels type is GuildText or casting it. |
Except that is not a valid solution because this issue happens when you want to check the messages from any text based channel |
I'm running into the same problem. Gotta @ts-ignore around this thing. |
This issue has now also been resolved on TS as of v5.2 so for people in previous versions the fix will be to update TS. There is a caveat though that is explained in https://devblogs.microsoft.com/typescript/announcing-typescript-5-2-rc/#easier-method-usage-for-unions-of-arrays |
Which package is this bug report for?
discord.js
Issue description
On v14.3.0, when you fetch the messages of a channel through
message.channel.messages.fetch()
without narrowing down the type of message.channel you get a Collection of Message or Message. Upon trying to call .filter on this collection, you will get the following error:This expression is not callable.
Each member of the union type '{ (fn: (value: Message, key: string, collection: Collection<string, Message>) => key is K2): Collection<K2, Message>; <V2 extends Message<...>>(fn: (value: Message<...>, key: string, collection: Collection<...>) => value is V2): Collection<...>; (fn: (value: Message<...>, key: st...' has signatures, but none of those signatures are compatible with each other. ts(2349)
This is because, since the message manager can come from multiple types of channels, the boolean type parameter can be true or false, and those two are not compatible with each other, thus TS cannot infer the type of the resulting filtered Collection
Code sample
Package version
14.3.0
Node.js version
18.7.0
Operating system
Windows 11
Priority this issue should have
High (immediate attention needed)
Which partials do you have configured?
Not applicable (subpackage bug)
Which gateway intents are you subscribing to?
Not applicable (subpackage bug)
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: