import { ValidationErrors } from './constants'; export interface ValidationErrorData { key: K; } export interface ValidationError { error: ValidationErrors | string; data: ValidationErrorData & D; } export type ValidationResponse = ValidationError | undefined | void; export type Validator = (value: D[K], key: K, data: D) => ValidationResponse; export type ValidationMap = { [K in keyof D]?: Validator[]; };