From 665f8b1d25d004bb7832f25593fe58081bedf85f Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 20 Sep 2023 01:59:48 +0200 Subject: [PATCH] Typing: make options optional in wikidata search --- src/Logic/Web/Wikidata.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Logic/Web/Wikidata.ts b/src/Logic/Web/Wikidata.ts index 7842be8a5..31eaa33d8 100644 --- a/src/Logic/Web/Wikidata.ts +++ b/src/Logic/Web/Wikidata.ts @@ -159,7 +159,7 @@ export default class Wikidata { */ public static async searchAdvanced( text: string, - options: WikidataAdvancedSearchoptions + options?: WikidataAdvancedSearchoptions ): Promise< { id: string @@ -185,7 +185,7 @@ export default class Wikidata { ?num wikibase:apiOrdinal true . bd:serviceParam wikibase:limit ${ Math.round( - (options.maxCount ?? 20) * 1.5 + (options?.maxCount ?? 20) * 1.5 ) /*Some padding for disambiguation pages */ } . ?label wikibase:apiOutput mwapi:label . @@ -193,7 +193,7 @@ export default class Wikidata { } ${instanceOf} ${minusPhrases.join("\n ")} - } ORDER BY ASC(?num) LIMIT ${options.maxCount ?? 20}` + } ORDER BY ASC(?num) LIMIT ${options?.maxCount ?? 20}` const url = wds.sparqlQuery(sparql) const result = await Utils.downloadJson(url)