The expected type comes from property 'content' which is declared here on type 'InteractionReplyOpti

const type: string = this.options.interaction.deferred || this.options.interaction.replied ? "editReply" : "reply";

await this.options.interaction[type]({
// code
const type: string = this.options.interaction.deferred || this.options.interaction.replied ? "editReply" : "reply";

await this.options.interaction[type]({
// code
like this it don't cause any problems but when i specify the type like this
const type: "reply" | "editReply" = this.options.interaction.deferred || this.options.interaction.replied ? "editReply" : "reply";
const type: "reply" | "editReply" = this.options.interaction.deferred || this.options.interaction.replied ? "editReply" : "reply";
it give me this error
No overload matches this call.
Overload 1 of 2, '(options: InteractionReplyOptions & { fetchReply: true; } & (string | MessagePayload | InteractionEditReplyOptions)): Promise<...>', gave the following error.
Type 'null' is not assignable to type 'string | undefined'.
Overload 2 of 2, '(options: (string | MessagePayload | InteractionReplyOptions) & (string | MessagePayload | InteractionEditReplyOptions)): Promise<...> | Promise<...>', gave the following error.
Type 'null' is not assignable to type 'string | undefined'.ts(2769)
index.d.ts(5888, 3): The expected type comes from property 'content' which is declared here on type 'InteractionReplyOptions & { fetchReply: true; } & (string | MessagePayload | InteractionEditReplyOptions)'
No overload matches this call.
Overload 1 of 2, '(options: InteractionReplyOptions & { fetchReply: true; } & (string | MessagePayload | InteractionEditReplyOptions)): Promise<...>', gave the following error.
Type 'null' is not assignable to type 'string | undefined'.
Overload 2 of 2, '(options: (string | MessagePayload | InteractionReplyOptions) & (string | MessagePayload | InteractionEditReplyOptions)): Promise<...> | Promise<...>', gave the following error.
Type 'null' is not assignable to type 'string | undefined'.ts(2769)
index.d.ts(5888, 3): The expected type comes from property 'content' which is declared here on type 'InteractionReplyOptions & { fetchReply: true; } & (string | MessagePayload | InteractionEditReplyOptions)'
4 Replies
d.js toolkit
d.js toolkit16mo 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!
Youssef
YoussefOP16mo ago
Yes exactly, it give me the error when i try to reply using that string
await this.options.interaction[type]({
//code
await this.options.interaction[type]({
//code
Yes
d.js docs
d.js docs16mo ago
interface InteractionReplyOptions Options for a reply to a BaseInteraction.
Youssef
YoussefOP16mo ago
Ok what should i pass instead of null, i can't pass en empty string tho I remember there was a thing you can pass i forget about it but like /a thing here So I'm replying before, i want to remove the content and send embeds It depends that why I'm checking, sometimes i reply sometimes not Alright thanks i did something like this content: type === "reply" ? "hello" : null but it still causing an error yeah i fixed it using this _ _ thanks anyway
Want results from more Discord servers?
Add your server