import { ComputedRef, Ref } from 'vue-demi'; import { Validation, ValidationRule, ValidationRuleWithoutParams, ValidationRuleWithParams, ValidationArgs } from '@vuelidate/core'; import { GenericInput, InputType, RuleNames } from './src/types'; export * from './src/types'; export type ValidationFunction = (value: any) => boolean; type ValidationRuleParams = ValidationRuleWithParams<{ equalTo: string; otherName: string; }> | ValidationRuleWithParams<{ max: number }> | ValidationRuleWithParams<{ min: number }> | ValidationRuleWithParams<{ length: number }> ; export const getRule: , I extends GenericInput = GenericInput>( rule: RuleNames | { key: string, func: ValidationFunction }, formData?: | { [key in keyof K]: any; } | Ref<{ [key in keyof K]: any; }>, ) => { key: string; func: ((value: string) => boolean) | (() => ValidationRule) | ValidationRuleParams | ValidationRuleWithParams | ValidationRuleWithoutParams } | undefined; export const useValidationRules: ( inputs: Ref> | ComputedRef> | InputType, formData: | Record | Ref> | ComputedRef>, ) => Record> | undefined>; export const useValidation: ( inputs: Ref> | ComputedRef> | InputType, formData: Record | Ref>, checkDirty?: boolean, registerAs?: string, callbacks?: Partial<{ onInputChange: (key: K, value: FormDataType[K]) => void; onInputInvalid: (key: K) => void; onInputValid: (key: K) => void; }>) => { v: Ref>>, Record>> isInvalid: Ref, isInputInvalid: (key: keyof FormDataType, excludeDirty?: boolean) => boolean, isInputSilentlyInvalid: (key: keyof FormDataType) => boolean, isInputTouched: (key: keyof FormDataType) => boolean }; export default useValidation;