1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export type Validator<T> = (object: T, key: string, componentName: string, ...rest: any[]) => Error | null;
|
8 |
|
9 | export interface Requireable<T> extends Validator<T> {
|
10 | isRequired: Validator<T>;
|
11 | }
|
12 |
|
13 | export type ValidationMap<T> = {[K in keyof T]?: Validator<T> };
|
14 |
|
15 | export const any: Requireable<any>;
|
16 | export const array: Requireable<any>;
|
17 | export const bool: Requireable<any>;
|
18 | export const func: Requireable<any>;
|
19 | export const number: Requireable<any>;
|
20 | export const object: Requireable<any>;
|
21 | export const string: Requireable<any>;
|
22 | export const node: Requireable<any>;
|
23 | export const element: Requireable<any>;
|
24 | export function instanceOf(expectedClass: {}): Requireable<any>;
|
25 | export function oneOf(types: any[]): Requireable<any>;
|
26 | export function oneOfType(types: Array<Validator<any>>): Requireable<any>;
|
27 | export function arrayOf(type: Validator<any>): Requireable<any>;
|
28 | export function objectOf(type: Validator<any>): Requireable<any>;
|
29 | export function shape(type: ValidationMap<any>): Requireable<any>;
|