1 |
|
2 |
|
3 |
|
4 | import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable';
|
5 |
|
6 |
|
7 |
|
8 | export interface Guard<A> {
|
9 | is: (u: unknown) => u is A;
|
10 | }
|
11 |
|
12 |
|
13 |
|
14 | export declare type TypeOf<G> = G extends Guard<infer A> ? A : never;
|
15 |
|
16 |
|
17 |
|
18 | export declare function literal<A extends ReadonlyArray<Literal>>(...values: A): Guard<A[number]>;
|
19 |
|
20 |
|
21 |
|
22 | export declare const never: Guard<never>;
|
23 |
|
24 |
|
25 |
|
26 | export declare const string: Guard<string>;
|
27 |
|
28 |
|
29 |
|
30 | export declare const number: Guard<number>;
|
31 |
|
32 |
|
33 |
|
34 | export declare const boolean: Guard<boolean>;
|
35 |
|
36 |
|
37 |
|
38 | export declare const UnknownArray: Guard<Array<unknown>>;
|
39 |
|
40 |
|
41 |
|
42 | export declare const UnknownRecord: Guard<Record<string, unknown>>;
|
43 |
|
44 |
|
45 |
|
46 | export declare function refinement<A, B extends A>(from: Guard<A>, refinement: (a: A) => a is B): Guard<B>;
|
47 |
|
48 |
|
49 |
|
50 | export declare function nullable<A>(or: Guard<A>): Guard<null | A>;
|
51 |
|
52 |
|
53 |
|
54 | export declare function type<A>(properties: {
|
55 | [K in keyof A]: Guard<A[K]>;
|
56 | }): Guard<{
|
57 | [K in keyof A]: A[K];
|
58 | }>;
|
59 |
|
60 |
|
61 |
|
62 | export declare function partial<A>(properties: {
|
63 | [K in keyof A]: Guard<A[K]>;
|
64 | }): Guard<Partial<{
|
65 | [K in keyof A]: A[K];
|
66 | }>>;
|
67 |
|
68 |
|
69 |
|
70 | export declare function record<A>(codomain: Guard<A>): Guard<Record<string, A>>;
|
71 |
|
72 |
|
73 |
|
74 | export declare function array<A>(items: Guard<A>): Guard<Array<A>>;
|
75 |
|
76 |
|
77 |
|
78 | export declare function tuple<A extends ReadonlyArray<unknown>>(...components: {
|
79 | [K in keyof A]: Guard<A[K]>;
|
80 | }): Guard<A>;
|
81 |
|
82 |
|
83 |
|
84 | export declare function intersection<A, B>(left: Guard<A>, right: Guard<B>): Guard<A & B>;
|
85 |
|
86 |
|
87 |
|
88 | export declare function union<A extends ReadonlyArray<unknown>>(...members: {
|
89 | [K in keyof A]: Guard<A[K]>;
|
90 | }): Guard<A[number]>;
|
91 |
|
92 |
|
93 |
|
94 | export declare function sum<T extends string>(tag: T): <A>(members: {
|
95 | [K in keyof A]: Guard<A[K]>;
|
96 | }) => Guard<A[keyof A]>;
|
97 |
|
98 |
|
99 |
|
100 | export declare function lazy<A>(f: () => Guard<A>): Guard<A>;
|
101 |
|
102 |
|
103 |
|
104 | export declare const URI = "io-ts/Guard";
|
105 |
|
106 |
|
107 |
|
108 | export declare type URI = typeof URI;
|
109 | declare module 'fp-ts/es6/HKT' {
|
110 | interface URItoKind<A> {
|
111 | readonly [URI]: Guard<A>;
|
112 | }
|
113 | }
|
114 |
|
115 |
|
116 |
|
117 | export declare const schemableGuard: Schemable1<URI> & WithUnknownContainers1<URI> & WithUnion1<URI> & WithRefinement1<URI>;
|