chore: even better if condition

This commit is contained in:
Lewis Crichton 2024-06-24 19:00:54 +01:00
parent faea1c8224
commit 2cd94221cd
No known key found for this signature in database

View file

@ -105,7 +105,7 @@ export function t(key: string, variables?: Record<string, any>): 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" :