Skip to content

Union

Example

import * as p from '@vbudovski/paseri';
const schema = p.union(p.number(), p.string());
const data = 'foo';
const result = schema.safeParse(data);
if (result.ok) {
// result.value typed as `number | string`.
}

Playground

Schema
Data
Result