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

fix(commandHelpers): Switch from logical OR to nullish coalescing for findOption() #3047

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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;
}