Linter errors in command options after upgrade
Hey there,
After upgrading to the freshest Sapphire and Discord.js versions I've got error in every command where I parse the options.
For example:
Here I got two errors in my linter:
Inside
.getChannel()
Expected 0 arguments, but got 1And at
.getString()
Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused">'The interesting thing is the errors are only inside my linter and in CLI it builds without any warns or errors. Did I forgot to add something or remove something from my
package.json
?11 Replies
have you tried reinstalling node_modules or regenerating your lockfile? and its not the linter, its the typescript which is warning you, also try to restart the TS server in your IDE
I've tried to reinstall node_modules, but haven't tried to regenerate the lock file
Now I've tried with
- deleting node_modules
- deleting yarn.lock
- restarting the TS server
- restarting the IDE completely
but the error is still there
quite weird because #getChannel requires one argument (3 in total) and the same for getString
are you sure by any chance the interaction type is not ChatInputCommandInteraction? @Feralheart
@Feralheart iirc there is a difference in types between ChatInputCommandInteraction and CommandInteraction
<::898645160248897586> ChatInputCommandInteraction#options
The options passed to the command.
<::898645160336977960> CommandInteractionOption
Represents an option of a received command interaction.
you sure typeof <interaction> is ChatInputCommandInteraction?
I've declared the method like this:
But if I change the typing to
ChatInputCommandInteraction
or to CommandInteraction
the error remainsthe issue should not persist at this point...considering you dont have any issues on build time as well
yes, I don't have any errors buildtime
delete node modules yarn cache yarn.lock and try again
tried it, but the error is still there
Solution
I had to reinstall the IDE and now it seems to work