UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

4 lines (3 loc) 309 B
import { anyOf } from '../../../schema/anyOf/index.js'; import { fromZodSchema } from './fromZodSchema.js'; export const fromZodDiscriminatedUnion = (zodDiscriminatedUnion) => anyOf(...zodDiscriminatedUnion.options.map(option => fromZodSchema(option))).discriminate(zodDiscriminatedUnion._def.discriminator);