Version mismatch between Sapphire and dapi-types

Hi, I was updating my dependencies when I encountered Discord.js' dapi-types error. I copy/pasted their solution in my package.json (https://discord.com/channels/222078108977594368/769862166131245066/1076213839990894604)
"overrides": {
"discord-api-types": "0.37.20"
}
"overrides": {
"discord-api-types": "0.37.20"
}
Which fixed all the Typescript's compilation errors. But now I have a runtime error with Sapphire failing to resolve dapi-types :
Error: Cannot find module 'discord-api-types/v10'
Require stack:
- ./node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistry.js
- ./node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistries.js
- ./node_modules/@sapphire/framework/dist/index.js
- ./node_modules/@sapphire/plugin-logger/dist/register.js
- ./node_modules/@sapphire/plugin-logger/register.js
- ./dist/src/main.js
Error: Cannot find module 'discord-api-types/v10'
Require stack:
- ./node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistry.js
- ./node_modules/@sapphire/framework/dist/lib/utils/application-commands/ApplicationCommandRegistries.js
- ./node_modules/@sapphire/framework/dist/index.js
- ./node_modules/@sapphire/plugin-logger/dist/register.js
- ./node_modules/@sapphire/plugin-logger/register.js
- ./dist/src/main.js
Versions of relevant deps (everything is latest from NPM) :
"dependencies": {
"@sapphire/async-queue": "^1.5.0",
"@sapphire/decorators": "^6.0.0",
"@sapphire/discord-utilities": "^3.0.0",
"@sapphire/discord.js-utilities": "^6.0.2",
"@sapphire/framework": "^4.2.0",
"@sapphire/plugin-logger": "^3.0.1",
"@sapphire/plugin-subcommands": "^4.0.0",
"@sapphire/stopwatch": "^1.5.0",
"@sapphire/type": "^2.3.0",
"@sapphire/utilities": "^3.11.0",
"discord.js": "^14.7.1",
},
"overrides": {
"discord-api-types": "0.37.20"
},
"dependencies": {
"@sapphire/async-queue": "^1.5.0",
"@sapphire/decorators": "^6.0.0",
"@sapphire/discord-utilities": "^3.0.0",
"@sapphire/discord.js-utilities": "^6.0.2",
"@sapphire/framework": "^4.2.0",
"@sapphire/plugin-logger": "^3.0.1",
"@sapphire/plugin-subcommands": "^4.0.0",
"@sapphire/stopwatch": "^1.5.0",
"@sapphire/type": "^2.3.0",
"@sapphire/utilities": "^3.11.0",
"discord.js": "^14.7.1",
},
"overrides": {
"discord-api-types": "0.37.20"
},
What should I do to fix this runtime error ? 😄 Thanks
Solution:
Because if so refer to https://discord.com/channels/222078108977594368/769862166131245066/1076213839990894604 and in your own code add proper checks using !isStageChannel (...)
Jump to solution
7 Replies
Favna
Favna•16mo ago
Remove the overrides then run npm dedupe. Everything is in the ^0.37.x range.
Elliot
Elliot•16mo ago
Thanks a lot, but now all the Discord.js' typescript compilation error are back I removed package-json and node-modules to regenerate a clean dep tree, installed everything, then ran npm dedupe As a temporary fix, i kept the overrides and went back to
"@sapphire/discord.js-utilities": "^6.0.0",
"@sapphire/framework": "^4.0.1",
"@sapphire/discord.js-utilities": "^6.0.0",
"@sapphire/framework": "^4.0.1",
Favna
Favna•16mo ago
Wait are you talking about send not being a function? With the initial post
Solution
Favna
Favna•16mo ago
Because if so refer to https://discord.com/channels/222078108977594368/769862166131245066/1076213839990894604 and in your own code add proper checks using !isStageChannel (...)
Favna
Favna•16mo ago
At any rate you should be able to use the latest dapi types if you also use latest djs sapphire. We fixed the send issue. This also hasn't been reported before. Not with npm users not yarn users.
Elliot
Elliot•16mo ago
my errors are all those :
error TS2339: Property 'messages' does not exist on type 'GuildTextBasedChannel'.
Property 'messages' does not exist on type 'StageChannel'.
error TS2339: Property 'messages' does not exist on type 'GuildTextBasedChannel'.
Property 'messages' does not exist on type 'StageChannel'.
I see what you mean, it seems like I need to add those manual checks everywhere pepeCry Thanks for your fast response
Elliot
Elliot•16mo ago
After thinking about it, I won't be doing that, i'll just stick with the older versions. Because StageChannel do have a chat in Discord, and Djs just merged a PR that adds the messages property to Stage Channel, so i'll just wait for that to land, rather than adding a stage-channel guard everywhere, and removing it the next time i update Djs