zod-v4-mocks
Version:
Mock generator for zod v4
27 lines (26 loc) • 972 B
TypeScript
import { z } from 'zod/v4';
import type { CustomGeneratorType, GeneraterOptions, MockConfig } from './type';
declare class MockGenerator {
protected options: GeneraterOptions;
constructor(config?: Partial<MockConfig>);
/**
* @description if return value is undefined, fallback to default generator
*/
supply(constructor: z.core.$constructor<any>, value: any): MockGenerator;
/**
* @description if return value is undefined, fallback to default generator
*/
override(customGenerator: CustomGeneratorType): MockGenerator;
register(schemas: z.ZodType[]): this;
generate(schema: z.ZodType): unknown;
}
export type { MockGenerator };
export declare function initGenerator(config?: Partial<MockConfig>): MockGenerator;
/**
* @deprecated Use generateMock function instead
*/
export declare class ZodMockGenerator {
private config;
constructor(config: Partial<MockConfig>);
generate(schema: z.ZodType): unknown;
}