Skip to main content

Function.isSupportedEmailLocale

function isSupportedEmailLocale(value: unknown): value is "en-US" | "fr-FR" | "es-ES" | "it-IT";

Type guard to check if a value is a supported email locale. Uses the supportedEmailLocaleSchema as the canonical source of truth.

Named after the type it narrows to (SupportedEmailLocale) to stay distinct from SupportedLocale (DPP content locales, EN/FR only) and avoid a future collision.

Parameters

ParameterTypeDescription
valueunknownThe value to check

Returns

value is "en-US" | "fr-FR" | "es-ES" | "it-IT"

True if the value is a supported email locale, false otherwise

Example

if (isSupportedEmailLocale(userPreference)) {
applyLocale(userPreference);
}