Skip to content

Types Reference

Abhijeet Kumar edited this page Nov 20, 2026 · 1 revision

Types Reference

Every schema entry names a type. All types support required, default and transform.

Type Output Notes
string string Supports trim, minLength, maxLength, pattern
number number Rejects NaN; supports min, max
int number Whole numbers only; supports min, max
boolean boolean true/false, 1/0, yes/no, on/off, y/n (case-insensitive)
url string Absolute URL; optional protocols allowlist, e.g. ['https']
port number Integer 0–65535
email string Pragmatic check: one @, a dot in the domain
json parsed value Objects, arrays or primitives
uuid string Canonical 8-4-4-4-12 form
hex string Hex characters, no 0x prefix; optional exact length
ipv4 string Four octets 0–255, no leading zeroes
semver string MAJOR.MINOR.PATCH, optional prerelease/build; no v prefix
base64 string Standard alphabet with padding
date Date ISO 8601 date or datetime; rejects impossible dates such as 2026-02-31
duration number (ms) 500ms, 30s, 15m, 2h, 1d; a bare number is milliseconds
host string Hostname or IP address; no scheme, path or port
file string Path to an existing, readable regular file

Useful options

  • choices — the coerced value must be one of the listed values
  • pattern — a RegExp a string value must match
  • minLength / maxLength — string length limits
  • min / max — numeric range limits
  • trim: false — keep surrounding whitespace
  • transform — one custom step after coercion, e.g. splitting a comma-separated list
  • { strict: true } (call option) — also flag variables that are set but not in the schema, which catches typos
  • { throwOnError: false } (call option) — return { env, errors } instead of throwing

The full, always-current reference is the Types table in the README.

Clone this wiki locally