import ts from 'typescript'; import type { Validation, Validator } from './types'; /** A function taking a `Validator` and producing its `TypeNode`. */ type TypeGenerator = (validator: V, references: ReadonlyMap, isInput: boolean) => ts.TypeNode; /** The generic constructor of a `Validator` instance. */ type ValidatorConstructor = { new (...args: any[]): V; }; /** Register a `TypeGenerator` function for a `Validator`. */ export declare function registerTypeGenerator(validator: V | ValidatorConstructor, generator: TypeGenerator): void; /** * Generate typings (validated or input type) for the given `Validation`s. * * When `isInput` is `false` (the default) then the _validated_ type will be * generated (that is, optional fields with default values will be considered * as defined). * * When `isInput` is `true` then the _input_ type will be generated (that is, * optional fields will be considered as optional). */ export declare function generateTypes(validations: Record, isInput?: boolean): string; /** * Generate a full declaration map for the specified validations. * * The full declaration map will include validated and input types and the * declaration of the validator itself. For example: * * ```ts * const testValidator = object({ test: optional(string, 'myValue' ) }) * generateDeclarations({ testValidator }) * ``` * * Will result in the following declaration to be emitted: * * ```ts * export type Test: { test: string } * export type TestInput: { test?: string } * export const testValidator: Validator * ``` */ export declare function generateDeclarations(validations: Record): string; export {};