FieldErrorText type alias

Module @runic-artifex/views in @runic-artifex/views 0.23.0

type FieldErrorText = (error: FieldError, locale: string | undefined) => string | undefined;

The application's text for a field error, as configureFieldErrorText takes it: the text to show for error in locale (the locale references are shown in, textLocale), or undefined to show its English message. Runic's parsers give an invalid-text error a reason and arguments; the other kinds carry the producer's message. With the generated ESM of Runic Translations and messages named after the reasons:

configureFieldErrorText((error, locale) => {
  const { text = "", scale = 0 } = error.arguments;
  const options = locale === undefined ? {} : { locale };
  if (error.reason === "not-a-number") return m.field_not_a_number({ text }, options);
  if (error.reason === "too-many-fraction-digits") return m.field_too_many_fraction_digits({ text, scale }, options);
  return undefined;
});