@@ -22,6 +22,7 @@ import TypeAlias from './types/TypeAlias'
2222import TypeReference from './types/TypeReference'
2323import Validation from './Validation'
2424import RuntimeTypeError from './errorReporting/RuntimeTypeError'
25+ import oneOf from './oneOf'
2526
2627export {
2728 Type ,
@@ -48,6 +49,7 @@ export {
4849 TypeReference ,
4950 Validation ,
5051 RuntimeTypeError ,
52+ oneOf ,
5153}
5254
5355export const any = ( ) : Type < any > => new AnyType ( )
@@ -223,47 +225,6 @@ export function allOf(...types: Type<any>[]): Type<any> {
223225 return new IntersectionType ( types )
224226}
225227
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-
267228export const alias = < T > ( name : string , type : Type < T > ) : TypeAlias < T > =>
268229 new TypeAlias ( name , type )
269230
0 commit comments