@@ -22,6 +22,7 @@ import TypeAlias from './types/TypeAlias'
22
22
import TypeReference from './types/TypeReference'
23
23
import Validation from './Validation'
24
24
import RuntimeTypeError from './errorReporting/RuntimeTypeError'
25
+ import oneOf from './oneOf'
25
26
26
27
export {
27
28
Type ,
@@ -48,6 +49,7 @@ export {
48
49
TypeReference ,
49
50
Validation ,
50
51
RuntimeTypeError ,
52
+ oneOf ,
51
53
}
52
54
53
55
export const any = ( ) : Type < any > => new AnyType ( )
@@ -223,47 +225,6 @@ export function allOf(...types: Type<any>[]): Type<any> {
223
225
return new IntersectionType ( types )
224
226
}
225
227
226
- export function oneOf < T1 > ( ...types : [ Type < T1 > ] ) : Type < T1 >
227
- export function oneOf < T1 , T2 > ( ...types : [ Type < T1 > , Type < T2 > ] ) : Type < T1 | T2 >
228
- export function oneOf < T1 , T2 , T3 > (
229
- ...types : [ Type < T1 > , Type < T2 > , Type < T3 > ]
230
- ) : Type < T1 | T2 | T3 >
231
- export function oneOf < T1 , T2 , T3 , T4 > (
232
- ...types : [ Type < T1 > , Type < T2 > , Type < T3 > , Type < T4 > ]
233
- ) : Type < T1 | T2 | T3 | T4 >
234
- export function oneOf < T1 , T2 , T3 , T4 , T5 > (
235
- ...types : [ Type < T1 > , Type < T2 > , Type < T3 > , Type < T4 > , Type < T5 > ]
236
- ) : Type < T1 | T2 | T3 | T4 | T5 >
237
- export function oneOf < T1 , T2 , T3 , T4 , T5 , T6 > (
238
- ...types : [ Type < T1 > , Type < T2 > , Type < T3 > , Type < T4 > , Type < T5 > , Type < T6 > ]
239
- ) : Type < T1 | T2 | T3 | T4 | T5 | T6 >
240
- export function oneOf < T1 , T2 , T3 , T4 , T5 , T6 , T7 > (
241
- ...types : [
242
- Type < T1 > ,
243
- Type < T2 > ,
244
- Type < T3 > ,
245
- Type < T4 > ,
246
- Type < T5 > ,
247
- Type < T6 > ,
248
- Type < T7 >
249
- ]
250
- ) : Type < T1 | T2 | T3 | T4 | T5 | T6 | T7 >
251
- export function oneOf < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 > (
252
- ...types : [
253
- Type < T1 > ,
254
- Type < T2 > ,
255
- Type < T3 > ,
256
- Type < T4 > ,
257
- Type < T5 > ,
258
- Type < T6 > ,
259
- Type < T7 > ,
260
- Type < T8 >
261
- ]
262
- ) : Type < T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 >
263
- export function oneOf ( ...types : Type < any > [ ] ) : Type < any > {
264
- return new UnionType ( types )
265
- }
266
-
267
228
export const alias = < T > ( name : string , type : Type < T > ) : TypeAlias < T > =>
268
229
new TypeAlias ( name , type )
269
230
0 commit comments