import { ParsingError } from '../errors/parsing_error'; import { SourceMapTypings, ParserTypings } from '../parser/types_parser'; export namespace Validation { export interface I18nRenderObj { [key: string]: string | number | null; } export type ErrorEntry = SourceMapTypings.Value & { parsingLineNumber: number; }; export type GetErrorTextFn = ( entry: ErrorEntry, i18nArgs?: I18nRenderObj ) => ReturnType; export type Cb = ( parser: ParserTypings.Parser, errorBuilder: ValidationErrorBuilder ) => void; export interface ValidationOptions { loopValidators?: Validation.Cb[]; getErrorText?: GetErrorTextFn; preValidators?: Validation.Cb[]; postValidators?: Validation.Cb[]; } export interface ValidationErrorBuilder { parsingLineNumber: number; entry: SourceMapTypings.Value; getErrorText: Validation.GetErrorTextFn; create>( overrides?: Overrides, i18nArgs?: Validation.I18nRenderObj ): ParsingError; } }