UNPKG

nope-validator

Version:
16 lines (15 loc) 626 B
import { NopePrimitive } from './NopePrimitive'; declare type RuleResult<T> = string | undefined | NopePrimitive<T>; export declare type Context = Record<string | number, any>; export declare type Rule<T> = (entry?: T | null, context?: Context) => RuleResult<T>; export declare type AsyncRule<T> = (entry?: T | null, context?: Context) => Promise<RuleResult<T>>; export interface Validatable<T> { validate: Rule<T>; validateAsync: AsyncRule<T>; getType: () => string; } export interface ShapeErrors { [key: string]: string | ShapeErrors; } export declare type Nil = null | undefined; export {};