11import { ComputedRef , Ref , UnwrapNestedRefs , UnwrapRef } from 'vue-demi' ;
22
3- export interface IRulesList {
3+ export declare interface IRulesList {
44 required ?: ( value : string ) => boolean ;
55 minLength ?: ( value : string , minLength : number ) => boolean ;
66 maxLength ?: ( value : string , maxLength : number ) => boolean ;
@@ -10,35 +10,36 @@ export interface IRulesList {
1010 date ?: ( value : string ) => boolean ;
1111}
1212
13- export type TObjectModel = Record < string , { model : TModel ; rules : TRule [ ] } > ;
14- export type TModel = string | number | boolean | null | Date | Object | TObjectModel ;
15- export type TValidateObjectRefModel = Record < string , { model : TModel ; rules : TRule [ ] } > ;
13+ export declare type TObjectModel = Record < string , { model : TModel ; rules : TRule [ ] } > ;
14+ export declare type TModel = string | number | boolean | null | Date | Object | TObjectModel ;
15+ export declare type TValidateObjectRefModel = Record < string , { model : TModel ; rules : TRule [ ] } > ;
1616
17- export type TSimpleRules = 'required' | 'email' | 'numeric' | 'date' ;
18- export type THardRules = 'minLength' | 'maxLength' | 'maxValue' ;
19- export type TRule = TSimpleRules | { type : THardRules ; value : number } ;
20- export type TModelRule = 'required' | 'email' | 'numeric' | 'date' | 'minLength' | 'maxLength' | 'maxValue' ;
17+ export declare type TSimpleRules = 'required' | 'email' | 'numeric' | 'date' ;
18+ export declare type THardRules = 'minLength' | 'maxLength' | 'maxValue' ;
19+ export declare type TRule = TSimpleRules | { type : THardRules ; value : number } ;
20+ export declare type TModelRule = 'required' | 'email' | 'numeric' | 'date' | 'minLength' | 'maxLength' | 'maxValue' ;
2121
22- export type TValidatedItem < T > = {
22+ export declare type TValidatedItem < T > = {
2323 model : Ref < T > ;
2424 isValid : Ref < boolean > ;
2525 modelRules : UnwrapRef < Record < TModelRule , boolean > > ;
2626} ;
2727
28- export type TRules =
28+ export declare type TRules =
2929 | { [ key in TSimpleRules ] : Pick < IRulesList , key > }
3030 | {
3131 type : Pick < IRulesList , THardRules > ;
3232 rule : TModelRule ;
3333} ;
3434
35- export type TValidatedObjectRef < T > = UnwrapNestedRefs < TValidatedReactiveObject < T > > & {
35+ export declare type TValidatedObjectRef < T > = UnwrapNestedRefs < TValidatedReactiveObject < T > > & {
3636 __isValid : ComputedRef < boolean > ;
3737 __clean : ComputedRef < UnwrapRef < T > > ;
3838} ;
3939
40- export type TValidatedReactiveObject < T > = {
40+ export declare type TValidatedReactiveObject < T > = {
4141 [ P in keyof T ] : TValidatedItem < T [ P ] > ;
4242} ;
4343
44- export { useValidate , useValidateObject } from "./index"
44+ export declare function useValidate < T > ( model : T , rules : TRule [ ] ) : UnwrapRef < TValidatedItem < T > >
45+ export declare function useValidateObject < T > ( model : TValidateObjectRefModel ) : UnwrapNestedRefs < TValidatedObjectRef < T > >
0 commit comments