zod-form-kit
Version:
UI-agnostic form generation library based on Zod schemas with extensible adapter pattern
17 lines (16 loc) • 596 B
TypeScript
import { z } from 'zod';
export type ParsedField = {
type: 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'object' | 'discriminatedUnion' | 'array';
required: boolean;
defaultValue?: any;
literalValue?: any;
isRecord?: boolean;
[key: string]: any;
};
/**
* Parses a Zod schema and returns a simplified representation of it.
* This is used to dynamically render a form based on the schema.
* @param schema The Zod schema to parse.
* @returns A simplified representation of the schema.
*/
export declare function parseZodSchema(schema: z.ZodTypeAny): ParsedField;