From 065ad1d5fde6a1fb361a0ead6a712b49e470e88e Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 31 Jan 2023 14:53:09 +0100 Subject: [PATCH] Fix typing error in wikidata textfield --- UI/Input/ValidatedTextField.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/UI/Input/ValidatedTextField.ts b/UI/Input/ValidatedTextField.ts index 594b9fdf0e..865391ef29 100644 --- a/UI/Input/ValidatedTextField.ts +++ b/UI/Input/ValidatedTextField.ts @@ -364,8 +364,12 @@ Another example is to search for species and trees: Locale.language .map((lg) => { - const prefixesUnrwapped: string[] = prefixes[lg] ?? prefixes - const postfixesUnwrapped: string[] = postfixes[lg] ?? postfixes + const prefixesUnrwapped: string[] = Array.isArray(prefixes) + ? prefixes + : prefixes[lg] ?? [] + const postfixesUnwrapped: string[] = Array.isArray(postfixes) + ? postfixes + : postfixes[lg] ?? [] let clipped = searchFor for (const postfix of postfixesUnwrapped) { @@ -375,6 +379,7 @@ Another example is to search for species and trees: } } + console.log("Prefixes are: ", prefixesUnrwapped) for (const prefix of prefixesUnrwapped) { if (searchFor.startsWith(prefix)) { clipped = searchFor.substring(prefix.length)