Skip to content
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

CommandHelpers: Make findOption use nullish coalescing #3047

Merged
merged 8 commits into from
Dec 3, 2024
2 changes: 1 addition & 1 deletion src/api/Commands/commandHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ export function sendBotMessage(channelId: string, message: PartialDeep<Message>)
export function findOption<T>(args: Argument[], name: string): T & {} | undefined;
export function findOption<T>(args: Argument[], name: string, fallbackValue: T): T & {};
export function findOption(args: Argument[], name: string, fallbackValue?: any) {
return (args.find(a => a.name === name)?.value || fallbackValue) as any;
return (args.find(a => a.name === name)?.value ?? fallbackValue) as any;
}
Loading