diff --git a/src/utils/relation.ts b/src/utils/relation.ts index 20290d2..3e96f11 100644 --- a/src/utils/relation.ts +++ b/src/utils/relation.ts @@ -28,6 +28,8 @@ export function whereAddressQuery(query: string) { ]; } -export function queryOrNot(query: string | boolean, where: T): T | undefined { - return !!query ? where : undefined; +export function queryOrNot(query: string | boolean, where: T): T | undefined; +export function queryOrNot(query: string | boolean, where: T, fallback: U): T | U; +export function queryOrNot(query: string | boolean, where: T, fallback?: U) { + return !!query ? where : fallback; }