Fix some type skullduggery.

This commit is contained in:
Sam Rose 2024-10-23 15:32:07 +01:00
parent f2a844c3b5
commit f7b84ca7ea
No known key found for this signature in database
2 changed files with 6 additions and 12 deletions

View File

@ -455,19 +455,18 @@ export function splitFiltersArray(filters: LegacyFilter[]) {
* Legacy support remains for the old **SearchFilter[]** format.
* These will be migrated to an appropriate **SearchFilters** object, if encountered
*/
export function buildQuery(filter: undefined): undefined
export function buildQuery(
filter: UISearchFilter | LegacyFilter[]
): SearchFilters
export function buildQuery(
filter?: UISearchFilter | LegacyFilter[]
): SearchFilters | undefined {
): SearchFilters {
if (!filter) {
return
return {}
}
if (Array.isArray(filter)) {
filter = processSearchFilters(filter) ?? []
filter = processSearchFilters(filter)
if (!filter) {
return {}
}
}
const operator = logicalOperatorFromUI(

View File

@ -139,11 +139,6 @@ export function isSupportedUserSearch(query: SearchFilters) {
return true
}
export function processSearchFilters(filterArray: undefined): undefined
export function processSearchFilters(filterArray: []): undefined
export function processSearchFilters(
filterArray: LegacyFilter[]
): Required<UISearchFilter>
export function processSearchFilters(
filterArray?: LegacyFilter[]
): Required<UISearchFilter> | undefined {