Discord.JS IntelliSense isn't working for my slash command. Any advice?

Everything works, I simply just don't get the IntelliSense, my imports seem correct, but I can't seem to figure out what is going on. Here is my code. Specifically I am trying to get the IntelliSense for interaction:
import { SlashCommandBuilder } from '@discordjs/builders';

export default {
data: new SlashCommandBuilder()
.setName('report')
.setDescription(
'Report user (WARNING: False reports will be treated as an offense)'
)
.addUserOption((option) =>
option
.setName('user')
.setDescription('Server users')
.setRequired(true)
),
async execute(interaction) {
// interaction.reply('Pong!');÷

const guild = interaction.guild;
try {
console.log('test');

const members = await guild.members.fetch();

// interaction.reply(members.s)
} catch (error) {
console.error(error);
}
},
};
import { SlashCommandBuilder } from '@discordjs/builders';

export default {
data: new SlashCommandBuilder()
.setName('report')
.setDescription(
'Report user (WARNING: False reports will be treated as an offense)'
)
.addUserOption((option) =>
option
.setName('user')
.setDescription('Server users')
.setRequired(true)
),
async execute(interaction) {
// interaction.reply('Pong!');÷

const guild = interaction.guild;
try {
console.log('test');

const members = await guild.members.fetch();

// interaction.reply(members.s)
} catch (error) {
console.error(error);
}
},
};
4 Replies
d.js toolkit
d.js toolkit4mo 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!
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs4mo ago
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
Anarchy
AnarchyOP4mo ago
I ended up using JSDocs and added this:
import { CommandInteraction } from 'discord.js';

/**
* @param {CommandInteraction} interaction
*/
import { CommandInteraction } from 'discord.js';

/**
* @param {CommandInteraction} interaction
*/
Want results from more Discord servers?
Add your server