Comparing version 2.0.0 to 2.0.1
@@ -8,3 +8,4 @@ { | ||
"coverage/": true | ||
} | ||
}, | ||
"editor.formatOnSave": true | ||
} |
@@ -52,2 +52,7 @@ import { Runtype as Rt, Static } from '../runtype'; | ||
} | ||
export interface Union11<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, I extends Rt, J extends Rt, K extends Rt> extends Rt<Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K>> { | ||
tag: 'union'; | ||
alternatives: [A, B, C, D, E, F, G, H, I, J, K]; | ||
match: Match11<A, B, C, D, E, F, G, H, I, J, K>; | ||
} | ||
/** | ||
@@ -96,2 +101,5 @@ * Construct a union runtype from runtypes for its alternatives. | ||
} | ||
export interface Match11<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, I extends Rt, J extends Rt, K extends Rt> { | ||
<Z>(a: Case<A, Z>, b: Case<B, Z>, c: Case<C, Z>, d: Case<D, Z>, e: Case<E, Z>, f: Case<F, Z>, g: Case<G, Z>, h: Case<H, Z>, i: Case<I, Z>, j: Case<J, Z>, k: Case<K, Z>): Matcher11<A, B, C, D, E, F, G, H, I, J, K, Z>; | ||
} | ||
export declare type Case<T extends Rt, Result> = (v: Static<T>) => Result; | ||
@@ -108,2 +116,3 @@ export declare type Static1<A extends Rt> = Static<A>; | ||
export declare type Static10<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, I extends Rt, J extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J>; | ||
export declare type Static11<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, I extends Rt, J extends Rt, K extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K>; | ||
export declare type Matcher1<A extends Rt, Z> = (x: Static1<A>) => Z; | ||
@@ -119,1 +128,2 @@ export declare type Matcher2<A extends Rt, B extends Rt, Z> = (x: Static2<A, B>) => Z; | ||
export declare type Matcher10<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, I extends Rt, J extends Rt, Z> = (x: Static10<A, B, C, D, E, F, G, H, I, J>) => Z; | ||
export declare type Matcher11<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, I extends Rt, J extends Rt, K extends Rt, Z> = (x: Static11<A, B, C, D, E, F, G, H, I, J, K>) => Z; |
{ | ||
"name": "runtypes", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Runtime validation for static types", | ||
@@ -22,3 +22,3 @@ "main": "./lib/index.js", | ||
"ts-jest": "^21.1.4", | ||
"typescript": "2.6.1" | ||
"typescript": "^2.6.2" | ||
}, | ||
@@ -47,3 +47,4 @@ "keywords:": [ | ||
"testEnvironment": "node" | ||
} | ||
}, | ||
"dependencies": {} | ||
} |
@@ -104,3 +104,3 @@ # Runtypes [![Build Status](https://travis-ci.org/pelotom/runtypes.svg?branch=master)](https://travis-ci.org/pelotom/runtypes) [![Coverage Status](https://coveralls.io/repos/pelotom/runtypes/badge.svg?branch=master)](https://coveralls.io/github/pelotom/runtypes?branch=master) | ||
(See the [examples](src/examples) directory for an expanded version of this.) | ||
(See the [examples](examples) directory for an expanded version of this.) | ||
@@ -186,3 +186,3 @@ Now if we are given a putative `SpaceObject` we can validate it like so: | ||
[Number, n => n * 3], | ||
[Boolean, b => (b ? 1 : 0)], | ||
[Boolean, b => b ? 1 : 0], | ||
[String, s => s.length], | ||
@@ -199,3 +199,3 @@ ); | ||
[Number, n => n * 3], | ||
[Boolean, b => (b ? 1 : 0)], | ||
[Boolean, b => b ? 1 : 0], | ||
[String, s => s.length], | ||
@@ -202,0 +202,0 @@ [Always, () => 42] |
@@ -136,2 +136,33 @@ import { Runtype as Rt, Static, create } from '../runtype'; | ||
export interface Union11< | ||
A extends Rt, | ||
B extends Rt, | ||
C extends Rt, | ||
D extends Rt, | ||
E extends Rt, | ||
F extends Rt, | ||
G extends Rt, | ||
H extends Rt, | ||
I extends Rt, | ||
J extends Rt, | ||
K extends Rt | ||
> | ||
extends Rt< | ||
| Static<A> | ||
| Static<B> | ||
| Static<C> | ||
| Static<D> | ||
| Static<E> | ||
| Static<F> | ||
| Static<G> | ||
| Static<H> | ||
| Static<I> | ||
| Static<J> | ||
| Static<K> | ||
> { | ||
tag: 'union'; | ||
alternatives: [A, B, C, D, E, F, G, H, I, J, K]; | ||
match: Match11<A, B, C, D, E, F, G, H, I, J, K>; | ||
} | ||
/** | ||
@@ -362,2 +393,29 @@ * Construct a union runtype from runtypes for its alternatives. | ||
} | ||
export interface Match11< | ||
A extends Rt, | ||
B extends Rt, | ||
C extends Rt, | ||
D extends Rt, | ||
E extends Rt, | ||
F extends Rt, | ||
G extends Rt, | ||
H extends Rt, | ||
I extends Rt, | ||
J extends Rt, | ||
K extends Rt | ||
> { | ||
<Z>( | ||
a: Case<A, Z>, | ||
b: Case<B, Z>, | ||
c: Case<C, Z>, | ||
d: Case<D, Z>, | ||
e: Case<E, Z>, | ||
f: Case<F, Z>, | ||
g: Case<G, Z>, | ||
h: Case<H, Z>, | ||
i: Case<I, Z>, | ||
j: Case<J, Z>, | ||
k: Case<K, Z>, | ||
): Matcher11<A, B, C, D, E, F, G, H, I, J, K, Z>; | ||
} | ||
@@ -449,2 +507,26 @@ export type Case<T extends Rt, Result> = (v: Static<T>) => Result; | ||
| Static<J>; | ||
export type Static11< | ||
A extends Rt, | ||
B extends Rt, | ||
C extends Rt, | ||
D extends Rt, | ||
E extends Rt, | ||
F extends Rt, | ||
G extends Rt, | ||
H extends Rt, | ||
I extends Rt, | ||
J extends Rt, | ||
K extends Rt | ||
> = | ||
| Static<A> | ||
| Static<B> | ||
| Static<C> | ||
| Static<D> | ||
| Static<E> | ||
| Static<F> | ||
| Static<G> | ||
| Static<H> | ||
| Static<I> | ||
| Static<J> | ||
| Static<K>; | ||
@@ -515,1 +597,15 @@ export type Matcher1<A extends Rt, Z> = (x: Static1<A>) => Z; | ||
> = (x: Static10<A, B, C, D, E, F, G, H, I, J>) => Z; | ||
export type Matcher11< | ||
A extends Rt, | ||
B extends Rt, | ||
C extends Rt, | ||
D extends Rt, | ||
E extends Rt, | ||
F extends Rt, | ||
G extends Rt, | ||
H extends Rt, | ||
I extends Rt, | ||
J extends Rt, | ||
K extends Rt, | ||
Z | ||
> = (x: Static11<A, B, C, D, E, F, G, H, I, J, K>) => Z; |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"exclude": ["./lib/**/*", "./src/examples/**/*"] | ||
"exclude": ["./lib/**/*", "./examples/**/*"] | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179204
145
4609