From 2cd94221cde2510bb1f101d120dde63cf53fb30e Mon Sep 17 00:00:00 2001 From: Lewis Crichton Date: Mon, 24 Jun 2024 19:00:54 +0100 Subject: [PATCH] chore: even better if condition --- src/utils/translation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/translation.tsx b/src/utils/translation.tsx index 3202b9982..60a6bfced 100644 --- a/src/utils/translation.tsx +++ b/src/utils/translation.tsx @@ -105,7 +105,7 @@ export function t(key: string, variables?: Record): string { const translation = _t(key, loadedLocale); if (typeof translation !== "string") { - if (!variables || !variables.count) + if (!variables?.count) throw new Error(`translation key ${key} is an object (is it a plural?)`); const pluralTag: Intl.LDMLPluralRule = variables.count === 0 ? "zero" :