Skip to content

invalid

function invalid(issue): Invalid;

The answer of a facet check when the value is refused. The change that carried the value fails. You return it from the validate function of ctx.facets.define.

Parameter Type Description
issue { code: string; message: string; path?: string; } code (a short name), message (what the person reads) and, if you want, path (where in the value the problem is)
issue.code string -
issue.message string -
issue.path? string -

Invalid

{ invalid: issue }

validate: value => (typeof value === 'number' ? valid() : invalid({ code: 'not-a-number', message: 'Minutes must be a number' }))