@@ -95,6 +95,23 @@ const RecD2_MutualRecursionArray: t.Type<
95
95
next : t . union ( [ t . undefined , RecD1_MutualRecursionReadonlyArray ] ) ,
96
96
} )
97
97
) ;
98
+
99
+ // tslint:disable-next-line:class-name
100
+ interface RecE2_RecordOfRecursion {
101
+ rr : Record < 'a' | 'b' | 'c' | 'd' | 'e' , RecE2_RecordOfRecursion > ;
102
+ }
103
+ // tslint:disable-next-line:variable-name
104
+ const RecE2_RecordOfRecursion : t . Type < RecE2_RecordOfRecursion > = t . recursion (
105
+ 'RecE2_RecordOfRecursion' ,
106
+ ( ) =>
107
+ t . type ( {
108
+ rr : t . record (
109
+ t . keyof ( { a : null , b : null , c : null , d : null , e : null } ) ,
110
+ RecE2_RecordOfRecursion
111
+ ) ,
112
+ } )
113
+ ) ;
114
+
98
115
// tslint:disable-next-line:no-any
99
116
export const types : Array < t . Type < any > > = [
100
117
// Recursive types
@@ -106,6 +123,7 @@ export const types: Array<t.Type<any>> = [
106
123
RecE1_ArrayOfRecursion ,
107
124
RecD1_MutualRecursionReadonlyArray ,
108
125
RecD2_MutualRecursionArray ,
126
+ RecE2_RecordOfRecursion ,
109
127
// Simple 0- or 1-depth types
110
128
t . number ,
111
129
t . string ,
@@ -146,7 +164,28 @@ export const types: Array<t.Type<any>> = [
146
164
t . readonly ( t . tuple ( [ t . string , t . boolean ] ) ) ,
147
165
t . readonly ( t . type ( { s : t . string , j : t . boolean } ) ) ,
148
166
167
+ t . UnknownRecord ,
168
+ t . record ( t . string , t . number ) ,
169
+ t . record ( t . keyof ( { 3 : null , b : null , true : null } ) , t . number ) ,
149
170
// Complex nested types
171
+ t . record (
172
+ t . string ,
173
+ t . union ( [
174
+ t . readonly (
175
+ t . partial ( { s : t . string , m : t . number , ___0000_extra_ : t . boolean } )
176
+ ) ,
177
+ t . readonly ( t . partial ( { s2 : t . string , j : t . boolean } ) ) ,
178
+ ] )
179
+ ) ,
180
+ t . record (
181
+ t . string ,
182
+ t . union ( [
183
+ t . readonly (
184
+ t . partial ( { s : t . string , m : t . number , ___0000_extra_ : t . boolean } )
185
+ ) ,
186
+ t . readonly ( t . partial ( { s2 : t . string , j : t . boolean } ) ) ,
187
+ ] )
188
+ ) ,
150
189
t . exact (
151
190
t . intersection ( [
152
191
t . type ( { s : t . string , m : t . number , ___0000_extra_ : t . boolean } ) ,
@@ -254,33 +293,12 @@ export const unknownTypes: Array<t.Decoder<unknown, unknown>> = [
254
293
weirdString ,
255
294
t . union ( [ t . string , weirdString ] ) ,
256
295
customStringDecoder ,
257
-
258
- // TODO - implement these:
259
- t . UnknownRecord ,
260
- t . record ( t . string , t . number ) ,
261
- t . record ( t . number , t . number ) ,
262
- t . record ( t . boolean , t . number ) ,
263
- t . record (
264
- t . string ,
265
- t . union ( [
266
- t . readonly (
267
- t . partial ( { s : t . string , m : t . number , ___0000_extra_ : t . boolean } )
268
- ) ,
269
- t . readonly ( t . partial ( { s2 : t . string , j : t . boolean } ) ) ,
270
- ] )
271
- ) ,
272
- t . record (
273
- t . string ,
274
- t . union ( [
275
- t . readonly (
276
- t . partial ( { s : t . string , m : t . number , ___0000_extra_ : t . boolean } )
277
- ) ,
278
- t . readonly ( t . partial ( { s2 : t . string , j : t . boolean } ) ) ,
279
- ] )
280
- ) ,
281
296
] ;
282
297
283
298
export const runtimeFailTypes = [
299
+ t . record ( t . number , t . number ) ,
300
+ t . record ( t . type ( { m : t . number } ) , t . number ) ,
301
+ t . record ( t . boolean , t . number ) ,
284
302
t . intersection ( [ t . string , t . type ( { m : t . number } ) ] ) ,
285
303
t . intersection ( [ t . type ( { m : t . number } ) , t . string ] ) ,
286
304
] ;
0 commit comments