1 | import { Predicate } from './predicates/predicate';
|
2 | import { BasePredicate } from './predicates/base-predicate';
|
3 | import { Modifiers } from './modifiers';
|
4 | import { Predicates } from './predicates';
|
5 |
|
6 |
|
7 |
|
8 | export declare type Main = <T>(value: T, label: string | Function, predicate: BasePredicate<T>, idLabel?: boolean) => void;
|
9 | export interface Ow extends Modifiers, Predicates {
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | <T>(value: unknown, predicate: BasePredicate<T>): asserts value is T;
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | <T>(value: unknown, label: string, predicate: BasePredicate<T>): asserts value is T;
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | isValid: <T>(value: T, predicate: BasePredicate<T>) => value is T;
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 | create: (<T>(predicate: BasePredicate<T>) => ReusableValidator<T>) & (<T>(label: string, predicate: BasePredicate<T>) => ReusableValidator<T>);
|
38 | }
|
39 | /**
|
40 | A reusable validator.
|
41 | */
|
42 | export interface ReusableValidator<T> {
|
43 | /**
|
44 | Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.
|
45 |
|
46 | @param value - Value to test.
|
47 | @param label - Override the label which should be used in error messages.
|
48 | */
|
49 | (value: T, label?: string): void;
|
50 | }
|
51 | declare const _ow: Ow;
|
52 | export default _ow;
|
53 | export { BasePredicate, Predicate };
|
54 | export * from './predicates';
|
55 | export { ArgumentError } from './argument-error';
|
56 |
|
\ | No newline at end of file |