Link Search Menu Expand Document

Email overview

Added in v1.0.0


Table of contents


utils

Email

Signature

export declare const Email: t.BrandC<t.StringC, EmailBrand>

Example

import * as t from 'io-ts'
import { Email } from 'io-ts-strings'

const codec = t.interface({
  email: Email,
})

codec.decode({ email: 'john@b.com' }) // Right
codec.decode({ email: 'john.com' }) // Left

Added in v1.0.0

Email (type alias)

Signature

export type Email = t.Branded<string, EmailBrand>

Added in v1.0.0

EmailBrand (interface)

Signature

export interface EmailBrand {
  readonly Email: unique symbol
}

Added in v1.0.0

emailDecoder

Signature

export declare const emailDecoder: <S extends string>() => D.Decoder<S, t.Branded<S, t.Branded<string, EmailBrand>>>

Added in v1.1.0