public async callHelp(data: DefaultHelpOptions | ReplacerHelpOptions | Snowflake): Promise<void> {
...
if (data.reason === "noadd") console.log(data.replacers);
...
}
// Typings
type HelpReasons = 'afk' | 'web';
type ReplacerHelpReasons = 'noadd' | 'nojoin';
export type DefaultReason = HelpReasons | ReplacerHelpReasons;
type HelpOptions = {
reason: string;
system: boolean;
}
type DefaultHelpOptions = HelpOptions & {
reason: HelpReasons;
};
type ReplacerHelpOptions = HelpOptions & {
reason: ReplacerHelpReasons;
replacers: { [key: string]: string };
};
#Typing
9 messages · Page 1 of 1 (latest)
- 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!
ello is not in any of your types
mb i edited out the explanation
basically, reason can be either a "DefaultReason" or any string
config.reasons[data.reason] ?? data.reason
If a default one is provided, it gets it from config, otherwise it will use the custom one
However, the only reasons with "replacers" option are ReplacerHelpReasons
i don't see how that lets you enter any string but i may have misunderstood
well that's the problem im trying to solve, i want to be able to enter any string
Then just type reason as string
well when i type it as a string, my replacers doesn't work