Number
Number fields use x.number() for numeric values. Parsed from common formats (commas, currency symbols, percentages).
columnNameAliases
Adds alternate CSV header names for this field.
.columnNameAliases(aliases: string[])
aliaseslists header names that should map to this schema key, e.g.,["Amount", "Total"].- Aliases are used during column matching alongside the field key and label. They do not change the output object key.
label
Sets the user-facing label shown in the importer.
.label(text: string)
textsets the label text.
description
Sets help text shown below the field.
.description(text: string)
textsets the description text.
optional
Allows the field to be empty.
.optional()
- Empty optional values are delivered as
null. - The row object still includes the field key, e.g.,
{ discount: null }.
default
Available after .optional().
.default(defaultValue: unknown | (() => unknown | Promise<unknown>))
defaultValuecan be a static value or a function used when the field is empty.- Defaults apply to missing values,
null, empty strings, and whitespace-only strings. - When a default is used, it is returned directly instead of validating or refining the empty value.
min
Sets the minimum numeric value.
.min(value: number, options?: { message?: string })
valuesets the minimum numeric value.messageoverrides the validation error text, e.g.,"Must be at least 18".
max
Sets the maximum numeric value.
.max(value: number, options?: { message?: string })
valuesets the maximum numeric value.messageoverrides the validation error text, e.g.,"Must be 100 or less".
integer
Restricts values to whole numbers.
.integer(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Must be a whole number".
multipleOf
Requires a multiple of a given value.
.multipleOf(value: number, options?: { message?: string })
valuesets the required step or divisor, e.g.,0.25.messageoverrides the validation error text, e.g.,"Must be a multiple of 5".
currency
Marks the number as a currency value.
.currency(currencyCode: string)
currencyCodesets the ISO 4217 currency code, e.g.,"USD"or"EUR".
percentage
Marks the number as a percentage for formatting.
.percentage()