Type error with ApplicationCommandType and ContextMenuCommandType
I just upgraded TypeScript and some other things in my package.json and it apparently now thinks that the following code is invalid:
When checking the types
ContextMenuCommandBuilder#setType()
requires the type ContextMenuCommandType
, which is resolved to ApplicationCommandType.Message | ApplicationCommandType.User
.
So why are these types not compatible to each other? Is this possibly due to a version mismatch?
My versions:
Thanks in advance.11 Replies
- 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
Or you can also use
// @ts-expect-error
for now, will be fixed in the next versionOh okay, thank you. I missed that while searching.
Which version of discord-api-types is used in 14.16.3? 0.37.100?
Override it to
0.37.101
, also no need install discord-api-types separatelyAlright. But how do I override it without a seperate entry in package.json?
you have to do it like this
Noted. This and restarting the TypeScript service solved it. I guess I can remove the override in the next version?
Yes
Alright. Thank you!
The fix is already merged, will be available when the next version releases
Perfect. Again, thanks for helping out!