You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7785fc8
Browse filesBrowse the repository at this point in the historyBrowse files
Adds `z.getDiscriminatedOption(union, value)`, which returns the option of a
discriminated union whose discriminator claims `value`. The result is narrowed
to the single matching option, including when one option declares several
values via `z.literal([...])`.
Defined in core and re-exported from both classic and mini, so both get the
identical function. The derived map is cached in the existing `_zod.bag`, so no
new internals property is added and nothing is computed until the util is first
called. The parse path is untouched.
Closes the by-value lookup half of #5086.
Co-authored-by: Alessandro Colace <ale.colace@gmail.com>
/** The discriminator values a member of `Options` can declare. An omittable discriminator contributes `undefined`, matching what `propValues` claims for it. */
0 commit comments