diff --git a/libs/common/src/tools/util.ts b/libs/common/src/tools/util.ts index e8292ec5b1a..0fcb5a972af 100644 --- a/libs/common/src/tools/util.ts +++ b/libs/common/src/tools/util.ts @@ -20,10 +20,14 @@ export function deepFreeze(value: T): Readonly { return Object.freeze(value); } +/** Type guard that returns `true` when the value is an i18n key. */ export function isI18nKey(value: I18nKeyOrLiteral): value is string { return typeof value === "string"; } -export function isLiteral(value: I18nKeyOrLiteral): value is string { +/** Type guard that returns `true` when the value requires no translation. + * @remarks the literal value can be accessed using the `.literal` property. + */ +export function isLiteral(value: I18nKeyOrLiteral): value is { literal: string } { return typeof value === "object" && "literal" in value; }