import * as express from 'express'; import { Location } from './location'; export type ErrorFormatter = (error: { location: Location, param: string, msg: any, value: any }) => T; export interface Result { array(options?: { onlyFirstError?: boolean }): T[]; formatWith(formatter: ErrorFormatter): this; isEmpty(): boolean; mapped(): Record; throw(): void; } export const validationResult: ResultFactory; export interface ResultFactory { (req: express.Request): Result; withDefaults(options?: Partial) : this; } interface ResultFactoryBuilderOptions { formatter: ErrorFormatter; }