-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(SlashCommandBuilder): add missing shared properties #10255
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Do you mind providing an example of where this fails? |
This should fix my issue |
import { SlashCommandBuilder } from "@discordjs/builders";
const command = new SlashCommandBuilder().setNSFW(true).addSubcommand(x => x);
command.nsfw; // Property 'nsfw' does not exist on type 'SlashCommandOptionsOnlyBuilder'.ts(2339)
console.log(command); // { ..., nsfw: true } Node: v22.1.0 Edit: I realize the error comment says "Options" however my code shows a subcommand - I was debugging the extent this issue reaches. For clarity, this issue is present when using both subcommands and options - using |
This comment was marked as spam.
This comment was marked as spam.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add in tests for this please, so we can be sure we don't make a regression again in the future 🙏
Vitest doesn't allow us to enable type checking as proposed in Discord in these |
Couldn't we have a separate test file just for types, and make vitest use type checking just in that one? |
See discordjs/discord.js#10255 for more context, but there is a known issue for discord.js that does produce the error encountered (incompatibility between `addStringOption()` and `SlashCommandBuilder`) If the problem persists should be useful to seek some assistance. Solved a path error on `command.js` and fixes on the commands Updated dependencies
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10255 +/- ##
===========================================
+ Coverage 19.14% 95.89% +76.75%
===========================================
Files 31 44 +13
Lines 6246 3634 -2612
Branches 73 111 +38
===========================================
+ Hits 1196 3485 +2289
+ Misses 5050 149 -4901
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Please describe the changes this PR makes and why it should be merged:
Following #10253, other properties were observed to also not be present when using options or subcommands. This PR adds those properties on the type level where they are present during runtime.
Status and versioning classification: