Skip to content

email ​

The string looks like an email: something@something.something, no spaces.

Signature ​

ts
function email(msg?: Message): Action<string>

Parameters ​

ParameterTypeDescription
msgMessageCustom error message. A string with {params} or a function

Error codes ​

CodeWhenDefault message
emailDoes not look like an emailInvalid email

You can change the texts: see Messages & i18n.

Notes ​

  • The check is intentionally simple: strict email regexes often reject real addresses. The only way to know an address exists is to send an email.
  • Usually combined with trim and toLowerCase to store emails consistently.

Example ​

Email ​

ts
pipe(string(), trim(), toLowerCase(), email())

See also ​