UNPKG

dynamodb-toolbox

Version:

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

12 lines (11 loc) 755 B
import { z } from 'zod'; import type { SetSchema } from '../../../../schema/index.js'; import type { Overwrite } from '../../../../types/overwrite.js'; import type { WithValidate } from '../utils.js'; import type { SchemaZodFormatter } from './schema.js'; import type { ZodFormatterOptions } from './types.js'; import type { WithOptional } from './utils.js'; export type SetZodFormatter<SCHEMA extends SetSchema, OPTIONS extends ZodFormatterOptions = {}> = SetSchema extends SCHEMA ? z.ZodTypeAny : WithOptional<SCHEMA, OPTIONS, WithValidate<SCHEMA, z.ZodSet<SchemaZodFormatter<SCHEMA['elements'], Overwrite<OPTIONS, { defined: true; }>>>>>; export declare const getSetZodFormatter: (schema: SetSchema, options?: ZodFormatterOptions) => z.ZodTypeAny;