// vue augmentation import Vue, { ComponentOptions } from "vue"; import { ValidationRule } from "./lib/validators"; import { Validation } from "./vuelidate"; declare module "vue/types/vue" { type ValidationProperties = { [P in Exclude]?: & Validation & ValidationProperties & ValidationEvaluation; }; interface ValidationGroups { [groupName: string]: Validation & ValidationProperties; } interface ValidationEvaluation { [ruleName: string]: boolean; } interface Vue { $v: ValidationProperties & ValidationGroups & Validation; delayTouch(v: Validation): void; } } declare module "vue/types/options" { interface ValidGroupDecl { [group: string]: string[]; } interface ValidPropertyDecl { [prop: string]: RuleDecl; } type ValidationDecl = ValidationRule | ((...args: any[]) => ValidationRule); type GroupDecl = string[]; type AsyncDecl = (...args: any[]) => boolean | Promise; type NestedDecl = RuleDecl; type DynamicDecl = () => RuleDecl; interface RuleDecl { [rule: string]: ValidationDecl | GroupDecl | AsyncDecl | NestedDecl; } interface ComponentOptions { validations?: RuleDecl | DynamicDecl | undefined; } }