Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/netzo/deps/zod/mod.ts>z.ZodDiscriminatedUnion.create

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
method z.ZodDiscriminatedUnion.create
import { z } from "https://deno.land/x/netzo@0.4.78/deps/zod/mod.ts";
const { ZodDiscriminatedUnion } = z;

The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. However, it only allows a union of objects, all of which need to share a discriminator property. This property must have a different value for each object in the union.

Parameters

discriminator: Discriminator

the name of the discriminator property

options: Types

an array of object schemas

optional
params: RawCreateParams