decoders 1.26.0-beta2 → 2.0.0-beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +21 -5
  2. package/_esm/_guard.js +15 -0
  3. package/_esm/_guard.js.flow +20 -0
  4. package/_esm/_types.js +0 -0
  5. package/_esm/_types.js.flow +20 -0
  6. package/_esm/_utils.js +93 -0
  7. package/_esm/_utils.js.flow +97 -0
  8. package/_esm/annotate.js +144 -0
  9. package/_esm/annotate.js.flow +218 -0
  10. package/_esm/core/array.js +91 -0
  11. package/{cjs → _esm/core}/array.js.flow +22 -25
  12. package/_esm/core/boolean.js +28 -0
  13. package/{cjs → _esm/core}/boolean.js.flow +8 -7
  14. package/_esm/core/composition.js +42 -0
  15. package/{cjs/utils.js.flow → _esm/core/composition.js.flow} +7 -22
  16. package/_esm/core/constants.js +46 -0
  17. package/{cjs → _esm/core}/constants.js.flow +13 -12
  18. package/_esm/core/date.js +28 -0
  19. package/{cjs → _esm/core}/date.js.flow +9 -7
  20. package/{cjs → _esm/core}/describe.js +5 -11
  21. package/{cjs → _esm/core}/describe.js.flow +4 -4
  22. package/{cjs → _esm/core}/dispatch.js +8 -15
  23. package/{cjs → _esm/core}/dispatch.js.flow +6 -5
  24. package/_esm/core/either.js +90 -0
  25. package/{cjs → _esm/core}/either.js.flow +55 -35
  26. package/_esm/core/fail.js +11 -0
  27. package/_esm/core/fail.js.flow +12 -0
  28. package/_esm/core/instanceOf.js +8 -0
  29. package/{cjs → _esm/core}/instanceOf.js.flow +7 -8
  30. package/_esm/core/json.js +15 -0
  31. package/{cjs → _esm/core}/json.js.flow +4 -4
  32. package/_esm/core/lazy.js +11 -0
  33. package/{cjs → _esm/core}/lazy.js.flow +1 -1
  34. package/_esm/core/mapping.js +54 -0
  35. package/_esm/core/mapping.js.flow +54 -0
  36. package/_esm/core/number.js +25 -0
  37. package/{cjs → _esm/core}/number.js.flow +10 -11
  38. package/_esm/core/object.js +175 -0
  39. package/{cjs → _esm/core}/object.js.flow +44 -52
  40. package/_esm/core/optional.js +38 -0
  41. package/{cjs → _esm/core}/optional.js.flow +6 -7
  42. package/{cjs → _esm/core}/string.js +18 -35
  43. package/{cjs → _esm/core}/string.js.flow +13 -12
  44. package/_esm/core/tuple.js +155 -0
  45. package/{cjs → _esm/core}/tuple.js.flow +62 -63
  46. package/_esm/format/index.js +2 -0
  47. package/_esm/format/index.js.flow +4 -0
  48. package/_esm/format/inline.js +137 -0
  49. package/_esm/format/inline.js.flow +122 -0
  50. package/_esm/format/short.js +4 -0
  51. package/_esm/format/short.js.flow +8 -0
  52. package/_esm/index.js +37 -0
  53. package/{cjs → _esm}/index.js.flow +31 -24
  54. package/_esm/result.js +139 -0
  55. package/_esm/result.js.flow +166 -0
  56. package/_guard.js +26 -0
  57. package/_guard.js.flow +20 -0
  58. package/_types.js +1 -0
  59. package/_types.js.flow +20 -0
  60. package/_utils.js +108 -0
  61. package/_utils.js.flow +97 -0
  62. package/annotate.js +161 -0
  63. package/annotate.js.flow +218 -0
  64. package/core/array.js +108 -0
  65. package/core/array.js.flow +103 -0
  66. package/core/boolean.js +44 -0
  67. package/core/boolean.js.flow +29 -0
  68. package/core/composition.js +56 -0
  69. package/core/composition.js.flow +43 -0
  70. package/core/constants.js +69 -0
  71. package/core/constants.js.flow +46 -0
  72. package/core/date.js +46 -0
  73. package/core/date.js.flow +40 -0
  74. package/core/describe.js +26 -0
  75. package/core/describe.js.flow +17 -0
  76. package/core/dispatch.js +62 -0
  77. package/core/dispatch.js.flow +58 -0
  78. package/core/either.js +117 -0
  79. package/core/either.js.flow +151 -0
  80. package/core/fail.js +21 -0
  81. package/core/fail.js.flow +12 -0
  82. package/core/instanceOf.js +19 -0
  83. package/core/instanceOf.js.flow +20 -0
  84. package/{cjs → core}/json.js +3 -5
  85. package/core/json.js.flow +28 -0
  86. package/{cjs → core}/lazy.js +1 -3
  87. package/core/lazy.js.flow +15 -0
  88. package/core/mapping.js +67 -0
  89. package/core/mapping.js.flow +54 -0
  90. package/core/number.js +40 -0
  91. package/core/number.js.flow +34 -0
  92. package/core/object.js +194 -0
  93. package/core/object.js.flow +203 -0
  94. package/core/optional.js +54 -0
  95. package/core/optional.js.flow +41 -0
  96. package/core/string.js +98 -0
  97. package/core/string.js.flow +82 -0
  98. package/core/tuple.js +173 -0
  99. package/core/tuple.js.flow +220 -0
  100. package/format/index.js +12 -0
  101. package/format/index.js.flow +4 -0
  102. package/format/inline.js +146 -0
  103. package/format/inline.js.flow +122 -0
  104. package/format/short.js +10 -0
  105. package/format/short.js.flow +8 -0
  106. package/index.js +120 -0
  107. package/index.js.flow +63 -0
  108. package/package.json +3 -11
  109. package/result.js +172 -0
  110. package/result.js.flow +166 -0
  111. package/cjs/array.js +0 -133
  112. package/cjs/boolean.js +0 -42
  113. package/cjs/constants.js +0 -67
  114. package/cjs/date.js +0 -42
  115. package/cjs/either.js +0 -85
  116. package/cjs/fail.js +0 -19
  117. package/cjs/fail.js.flow +0 -13
  118. package/cjs/guard.js +0 -30
  119. package/cjs/guard.js.flow +0 -36
  120. package/cjs/index.js +0 -397
  121. package/cjs/instanceOf.js +0 -17
  122. package/cjs/mapping.js +0 -113
  123. package/cjs/mapping.js.flow +0 -71
  124. package/cjs/number.js +0 -38
  125. package/cjs/object.js +0 -254
  126. package/cjs/optional.js +0 -52
  127. package/cjs/tuple.js +0 -199
  128. package/cjs/types.js +0 -3
  129. package/cjs/types.js.flow +0 -26
  130. package/cjs/utils.js +0 -70
  131. package/es/index.js +0 -1039
  132. package/ts/array.d.ts +0 -5
  133. package/ts/boolean.d.ts +0 -5
  134. package/ts/constants.d.ts +0 -11
  135. package/ts/date.d.ts +0 -4
  136. package/ts/describe.d.ts +0 -3
  137. package/ts/dispatch.d.ts +0 -8
  138. package/ts/either.d.ts +0 -61
  139. package/ts/fail.d.ts +0 -3
  140. package/ts/guard.d.ts +0 -7
  141. package/ts/helpers.d.ts +0 -79
  142. package/ts/index.d.ts +0 -38
  143. package/ts/instanceOf.d.ts +0 -3
  144. package/ts/json.d.ts +0 -11
  145. package/ts/lazy.d.ts +0 -3
  146. package/ts/mapping.d.ts +0 -4
  147. package/ts/number.d.ts +0 -6
  148. package/ts/object.d.ts +0 -33
  149. package/ts/optional.d.ts +0 -5
  150. package/ts/string.d.ts +0 -7
  151. package/ts/tuple.d.ts +0 -30
  152. package/ts/types.d.ts +0 -18
  153. package/ts/utils.d.ts +0 -13
package/ts/array.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export const poja: Decoder<unknown[]>;
4
- export function array<T>(decoder: Decoder<T>): Decoder<T[]>;
5
- export function nonEmptyArray<T>(decoder: Decoder<T>): Decoder<[T, ...T[]]>;
package/ts/boolean.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export const boolean: Decoder<boolean>;
4
- export const truthy: Decoder<boolean>;
5
- export const numericBoolean: Decoder<boolean>;
package/ts/constants.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Decoder, Scalar } from './types';
2
-
3
- // Constants
4
-
5
- export const null_: Decoder<null>;
6
- export const undefined_: Decoder<undefined>;
7
- export function constant<T extends Scalar>(value: T): Decoder<T>;
8
- export function hardcoded<T extends Scalar>(value: T): Decoder<T>;
9
- export function hardcoded<T>(value: T): Decoder<T>;
10
- export const mixed: Decoder<unknown>;
11
- export const unknown: Decoder<unknown>;
package/ts/date.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export const date: Decoder<Date>;
4
- export const iso8601: Decoder<Date>;
package/ts/describe.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function describe<T>(decoder: Decoder<T>, msg: string): Decoder<T>;
package/ts/dispatch.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { Decoder, $DecoderType } from './types';
2
-
3
- export type $Values<T extends object> = T[keyof T];
4
-
5
- export function dispatch<O extends { [key: string]: Decoder<any> }>(
6
- field: string,
7
- mapping: O
8
- ): Decoder<$Values<{ [key in keyof O]: $DecoderType<O[key]> }>>;
package/ts/either.d.ts DELETED
@@ -1,61 +0,0 @@
1
- import { Decoder, Scalar } from './types';
2
-
3
- export function either<T1, T2>(d1: Decoder<T1>, d2: Decoder<T2>): Decoder<T1 | T2>;
4
- export function either2<T1, T2>(d1: Decoder<T1>, d2: Decoder<T2>): Decoder<T1 | T2>;
5
- export function either3<T1, T2, T3>(
6
- d1: Decoder<T1>,
7
- d2: Decoder<T2>,
8
- d3: Decoder<T3>
9
- ): Decoder<T1 | T2 | T3>;
10
- export function either4<T1, T2, T3, T4>(
11
- d1: Decoder<T1>,
12
- d2: Decoder<T2>,
13
- d3: Decoder<T3>,
14
- d4: Decoder<T4>
15
- ): Decoder<T1 | T2 | T3 | T4>;
16
- export function either5<T1, T2, T3, T4, T5>(
17
- d1: Decoder<T1>,
18
- d2: Decoder<T2>,
19
- d3: Decoder<T3>,
20
- d4: Decoder<T4>,
21
- d5: Decoder<T5>
22
- ): Decoder<T1 | T2 | T3 | T4 | T5>;
23
- export function either6<T1, T2, T3, T4, T5, T6>(
24
- d1: Decoder<T1>,
25
- d2: Decoder<T2>,
26
- d3: Decoder<T3>,
27
- d4: Decoder<T4>,
28
- d5: Decoder<T5>,
29
- d6: Decoder<T6>
30
- ): Decoder<T1 | T2 | T3 | T4 | T5 | T6>;
31
- export function either7<T1, T2, T3, T4, T5, T6, T7>(
32
- d1: Decoder<T1>,
33
- d2: Decoder<T2>,
34
- d3: Decoder<T3>,
35
- d4: Decoder<T4>,
36
- d5: Decoder<T5>,
37
- d6: Decoder<T6>,
38
- d7: Decoder<T7>
39
- ): Decoder<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
40
- export function either8<T1, T2, T3, T4, T5, T6, T7, T8>(
41
- d1: Decoder<T1>,
42
- d2: Decoder<T2>,
43
- d3: Decoder<T3>,
44
- d4: Decoder<T4>,
45
- d5: Decoder<T5>,
46
- d6: Decoder<T6>,
47
- d7: Decoder<T7>,
48
- d8: Decoder<T8>
49
- ): Decoder<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
50
- export function either9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
51
- d1: Decoder<T1>,
52
- d2: Decoder<T2>,
53
- d3: Decoder<T3>,
54
- d4: Decoder<T4>,
55
- d5: Decoder<T5>,
56
- d6: Decoder<T6>,
57
- d7: Decoder<T7>,
58
- d8: Decoder<T8>,
59
- d9: Decoder<T9>
60
- ): Decoder<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
61
- export function oneOf<T extends Scalar>(constants: readonly T[]): Decoder<T>;
package/ts/fail.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function fail(msg: string): Decoder<never>;
package/ts/guard.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { Decoder, Guard } from './types';
2
-
3
- export interface Options {
4
- style?: 'inline' | 'simple';
5
- }
6
-
7
- export function guard<T>(decoder: Decoder<T>, options?: Options): Guard<T>;
package/ts/helpers.d.ts DELETED
@@ -1,79 +0,0 @@
1
- /**
2
- * Given a type like:
3
- *
4
- * {
5
- * a: string;
6
- * b: number | undefined;
7
- * c: null | undefined;
8
- * d: null;
9
- * e: undefined;
10
- * }
11
- *
12
- * Will drop all the "undefined" types. In this case, only "e":
13
- *
14
- * {
15
- * a: string;
16
- * b: number | undefined;
17
- * c: null | undefined;
18
- * d: null;
19
- * }
20
- *
21
- */
22
- type Compact<T> = { [K in IsDefined<T, keyof T>]: T[K] };
23
-
24
- type IsDefined<T, K extends keyof T> = K extends any
25
- ? T[K] extends undefined
26
- ? never
27
- : K
28
- : never;
29
-
30
- //
31
- // HACK:
32
- // These weird conditionals test whether TypeScript is configured with the
33
- // `strictNullChecks` compiler option. We use these definitions to influence
34
- // what's considered a "required" vs an "optional" key for the AllowImplicit
35
- // type.
36
- //
37
- // If strictNullChecks is false, then we should not be emitting any `?` fields
38
- // and consider all fields "required" because everything is optional by default
39
- // in that mode anyway.
40
- //
41
- type NoStrictNullChecks = undefined extends string ? 1 : undefined;
42
- // ^^^^^^^^^^^^^^^^^^^^^^^^
43
- type StrictNullChecks = undefined extends string ? undefined : 1;
44
- // ^^^^^^^^^^^^^^^^^^^^^^^^
45
-
46
- export type RequiredKeys<T> = keyof Compact<{
47
- [K in keyof T]: undefined extends T[K] ? NoStrictNullChecks : 1;
48
- }>;
49
-
50
- export type OptionalKeys<T> = keyof Compact<{
51
- [K in keyof T]: undefined extends T[K] ? 1 : StrictNullChecks;
52
- }>;
53
-
54
- /**
55
- * Transforms an object type, by marking all fields that contain "undefined"
56
- * with a question mark, i.e. allowing implicit-undefineds when
57
- * explicit-undefined are also allowed.
58
- *
59
- * For example, if:
60
- *
61
- * type User = {
62
- * name: string;
63
- * age: number | null | undefined;
64
- * }
65
- *
66
- * Then AllowImplicit<User> will become equivalent to:
67
- *
68
- * {
69
- * name: string;
70
- * age?: number | null;
71
- * ^
72
- * Note the question mark
73
- * }
74
- */
75
- type AllowImplicit<T> = { [K in RequiredKeys<T>]-?: T[K] } & {
76
- [K in OptionalKeys<T>]+?: Exclude<T[K], undefined>;
77
- };
78
-
79
- export { AllowImplicit };
package/ts/index.d.ts DELETED
@@ -1,38 +0,0 @@
1
- import { Decoder, DecoderType, Guard, GuardType } from './types';
2
-
3
- export { guard } from './guard';
4
- export { compose, map, predicate } from './utils';
5
-
6
- export { array, nonEmptyArray, poja } from './array';
7
- export { boolean, numericBoolean, truthy } from './boolean';
8
- export { constant, hardcoded, mixed, null_, undefined_, unknown } from './constants';
9
- export { date, iso8601 } from './date';
10
- export { describe } from './describe';
11
- export { dispatch } from './dispatch';
12
- export {
13
- either,
14
- either3,
15
- either4,
16
- either5,
17
- either6,
18
- either7,
19
- either8,
20
- either9,
21
- oneOf,
22
- } from './either';
23
- export { fail } from './fail';
24
- export { instanceOf } from './instanceOf';
25
- export { json, jsonArray, jsonObject } from './json';
26
- export { lazy } from './lazy';
27
- export { mapping, dict } from './mapping';
28
- export { integer, number, positiveInteger, positiveNumber } from './number';
29
- export { exact, inexact, object, pojo } from './object';
30
- export { maybe, nullable, optional } from './optional';
31
- export { email, nonEmptyString, regex, string, url } from './string';
32
- export { tuple1, tuple2, tuple3, tuple4, tuple5, tuple6 } from './tuple';
33
-
34
- export { Decoder, Guard };
35
- export { DecoderType, GuardType };
36
- export { JSONArray, JSONObject, JSONValue } from './json';
37
-
38
- export type $DecoderType<T> = DecoderType<T>; // Alias for backward compatibility
@@ -1,3 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function instanceOf<T>(klass: new (...args: any) => T): Decoder<T>;
package/ts/json.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
4
- export interface JSONObject {
5
- [key: string]: JSONValue;
6
- }
7
- export type JSONArray = JSONValue[];
8
-
9
- export const json: Decoder<JSONValue>;
10
- export const jsonArray: Decoder<JSONArray>;
11
- export const jsonObject: Decoder<JSONObject>;
package/ts/lazy.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function lazy<T>(decoderFn: () => Decoder<T>): Decoder<T>;
package/ts/mapping.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function mapping<T>(decoder: Decoder<T>): Decoder<Map<string, T>>;
4
- export function dict<T>(decoder: Decoder<T>): Decoder<{ [key: string]: T }>;
package/ts/number.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export const integer: Decoder<number>;
4
- export const number: Decoder<number>;
5
- export const positiveInteger: Decoder<number>;
6
- export const positiveNumber: Decoder<number>;
package/ts/object.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import { $DecoderType, Decoder } from './types';
2
- import { AllowImplicit } from './helpers';
3
-
4
- export type ObjectDecoderType<T> = AllowImplicit<{
5
- [key in keyof T]: $DecoderType<T[key]>;
6
- }>;
7
-
8
- export const pojo: Decoder<{ [key: string]: unknown }>;
9
-
10
- export function object<O extends { [key: string]: Decoder<any> }>(
11
- mapping: O
12
- ): Decoder<{ [K in keyof ObjectDecoderType<O>]: ObjectDecoderType<O>[K] }>;
13
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
- // This is basically just equivalent to:
15
- // ObjectDecoderType<O>
16
- //
17
- // But by "resolving" this with a mapped type, we remove the helper
18
- // type names from the inferred type here, making this much easier to
19
- // work with while developing.
20
-
21
- export function exact<O extends { [key: string]: Decoder<any> }>(
22
- mapping: O
23
- ): Decoder<{ [K in keyof ObjectDecoderType<O>]: ObjectDecoderType<O>[K] }>;
24
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25
- // Ditto (see above)
26
-
27
- export function inexact<O extends { [key: string]: Decoder<any> }>(
28
- mapping: O
29
- ): Decoder<
30
- { [K in keyof ObjectDecoderType<O>]: ObjectDecoderType<O>[K] } & {
31
- [extra: string]: unknown;
32
- }
33
- >;
package/ts/optional.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function optional<T>(decoder: Decoder<T>): Decoder<T | undefined>;
4
- export function nullable<T>(decoder: Decoder<T>): Decoder<T | null>;
5
- export function maybe<T>(decoder: Decoder<T>): Decoder<T | null | undefined>;
package/ts/string.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export const string: Decoder<string>;
4
- export const nonEmptyString: Decoder<string>;
5
- export function regex(regex: RegExp, msg: string): Decoder<string>;
6
- export const email: Decoder<string>;
7
- export function url(schemes?: readonly string[]): Decoder<string>;
package/ts/tuple.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function tuple1<T1>(d1: Decoder<T1>): Decoder<[T1]>;
4
- export function tuple2<T1, T2>(d1: Decoder<T1>, d2: Decoder<T2>): Decoder<[T1, T2]>;
5
- export function tuple3<T1, T2, T3>(
6
- d1: Decoder<T1>,
7
- d2: Decoder<T2>,
8
- d3: Decoder<T3>
9
- ): Decoder<[T1, T2, T3]>;
10
- export function tuple4<T1, T2, T3, T4>(
11
- d1: Decoder<T1>,
12
- d2: Decoder<T2>,
13
- d3: Decoder<T3>,
14
- d4: Decoder<T4>
15
- ): Decoder<[T1, T2, T3, T4]>;
16
- export function tuple5<T1, T2, T3, T4, T5>(
17
- d1: Decoder<T1>,
18
- d2: Decoder<T2>,
19
- d3: Decoder<T3>,
20
- d4: Decoder<T4>,
21
- d5: Decoder<T5>
22
- ): Decoder<[T1, T2, T3, T4, T5]>;
23
- export function tuple6<T1, T2, T3, T4, T5, T6>(
24
- d1: Decoder<T1>,
25
- d2: Decoder<T2>,
26
- d3: Decoder<T3>,
27
- d4: Decoder<T4>,
28
- d5: Decoder<T5>,
29
- d6: Decoder<T6>
30
- ): Decoder<[T1, T2, T3, T4, T5, T6]>;
package/ts/types.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Annotation } from 'debrief';
2
- import { Result } from 'lemons';
3
-
4
- export type Scalar = string | number | boolean | symbol | undefined | null;
5
-
6
- export interface Guard<T> {
7
- (blob: unknown): T;
8
- }
9
- export type Predicate<T> = (value: T) => boolean;
10
- export type DecodeResult<T> = Result<Annotation, T>;
11
- export interface Decoder<T, F = unknown> {
12
- (blob: F): DecodeResult<T>;
13
- }
14
-
15
- export type DecoderType<T> = T extends Decoder<infer V> ? V : never;
16
- export type $DecoderType<T> = DecoderType<T>; // Alias for backward compatibility
17
-
18
- export type GuardType<T> = T extends Guard<infer V> ? V : never;
package/ts/utils.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { Decoder } from './types';
2
-
3
- export function isDate(value: unknown): boolean;
4
- export function map<T, V>(decoder: Decoder<T>, mapper: (value: T) => V): Decoder<V>;
5
- export function compose<T, V>(decoder: Decoder<T>, next: Decoder<V, T>): Decoder<V>;
6
- export function predicate<T extends F, F = unknown>(
7
- predicate: (value: F) => value is T,
8
- msg: string
9
- ): Decoder<T, F>;
10
- export function predicate<T>(
11
- predicate: (value: T) => boolean,
12
- msg: string
13
- ): Decoder<T, T>;