Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

runtypes

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runtypes - npm Package Compare versions

Comparing version 2.1.6 to 2.2.0

lib/decorator.d.ts

1

lib/index.d.ts

@@ -26,1 +26,2 @@ export { Runtype, Static } from './runtype';

export { Brand } from './types/brand';
export * from './decorator';

@@ -33,1 +33,2 @@ "use strict";

exports.Brand = brand_1.Brand;
__export(require("./decorator"));

40

lib/reflect.d.ts

@@ -6,23 +6,23 @@ import { Runtype } from './runtype';

import { Constructor } from './types/instanceof';
export declare type Reflect = {
export declare type Reflect = ({
tag: 'always';
} & Runtype<always> | {
} & Runtype<always>) | ({
tag: 'never';
} & Runtype<never> | {
} & Runtype<never>) | ({
tag: 'void';
} & Runtype<void> | {
} & Runtype<void>) | ({
tag: 'boolean';
} & Runtype<boolean> | {
} & Runtype<boolean>) | ({
tag: 'number';
} & Runtype<number> | {
} & Runtype<number>) | ({
tag: 'string';
} & Runtype<string> | {
} & Runtype<string>) | ({
tag: 'symbol';
} & Runtype<symbol> | {
} & Runtype<symbol>) | ({
tag: 'literal';
value: LiteralBase;
} & Runtype<LiteralBase> | {
} & Runtype<LiteralBase>) | ({
tag: 'array';
element: Reflect;
} & Runtype<always[]> | {
} & Runtype<always[]>) | ({
tag: 'record';

@@ -34,3 +34,3 @@ fields: {

[_ in string]: always;
}> | {
}>) | ({
tag: 'partial';

@@ -42,3 +42,3 @@ fields: {

[_ in string]?: always;
}> | {
}>) | ({
tag: 'dictionary';

@@ -49,14 +49,14 @@ key: 'string' | 'number';

[_: string]: always;
}> | {
}>) | ({
tag: 'tuple';
components: Reflect[];
} & Runtype<always[]> | {
} & Runtype<always[]>) | ({
tag: 'union';
alternatives: Reflect[];
} & Runtype<always> | {
} & Runtype<always>) | ({
tag: 'intersect';
intersectees: Reflect[];
} & Runtype<always> | {
} & Runtype<always>) | ({
tag: 'function';
} & Runtype<(...args: any[]) => any> | {
} & Runtype<(...args: any[]) => any>) | ({
tag: 'constraint';

@@ -66,9 +66,9 @@ underlying: Reflect;

args?: any;
} & Runtype<always> | {
} & Runtype<always>) | ({
tag: 'instanceof';
ctor: Constructor<always>;
} & Runtype<always> | {
} & Runtype<always>) | ({
tag: 'brand';
brand: string;
entity: Reflect;
} & Runtype<always>;
} & Runtype<always>);
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -7,0 +10,0 @@ extendStatics(d, b);

import { Runtype as Rt, Static } from '../runtype';
export interface Union1<A extends Rt> extends Rt<Static1<A>> {
export interface Union1<A extends Rt> extends Rt<Static<A>> {
tag: 'union';

@@ -7,3 +7,3 @@ alternatives: [A];

}
export interface Union2<A extends Rt, B extends Rt> extends Rt<Static2<A, B>> {
export interface Union2<A extends Rt, B extends Rt> extends Rt<Static<A | B>> {
tag: 'union';

@@ -13,3 +13,3 @@ alternatives: [A, B];

}
export interface Union3<A extends Rt, B extends Rt, C extends Rt> extends Rt<Static3<A, B, C>> {
export interface Union3<A extends Rt, B extends Rt, C extends Rt> extends Rt<Static<A | B | C>> {
tag: 'union';

@@ -188,41 +188,21 @@ alternatives: [A, B, C];

export declare type Case<T extends Rt, Result> = (v: Static<T>) => Result;
export declare type Static1<A extends Rt> = Static<A>;
export declare type Static2<A extends Rt, B extends Rt> = Static<A> | Static<B>;
export declare type Static3<A extends Rt, B extends Rt, C extends Rt> = Static<A> | Static<B> | Static<C>;
export declare type Static4<A extends Rt, B extends Rt, C extends Rt, D extends Rt> = Static<A> | Static<B> | Static<C> | Static<D>;
export declare type Static5<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E>;
export declare type Static6<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F>;
export declare type Static7<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G>;
export declare type Static8<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H>;
export declare type Static9<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> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I>;
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 Static12<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, L extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L>;
export declare type Static13<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, L extends Rt, M extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M>;
export declare type Static14<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, L extends Rt, M extends Rt, N extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N>;
export declare type Static15<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N> | Static<O>;
export declare type Static16<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N> | Static<O> | Static<P>;
export declare type Static17<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N> | Static<O> | Static<P> | Static<Q>;
export declare type Static18<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N> | Static<O> | Static<P> | Static<Q> | Static<R>;
export declare type Static19<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, S extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N> | Static<O> | Static<P> | Static<Q> | Static<R> | Static<S>;
export declare type Static20<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, S extends Rt, T extends Rt> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H> | Static<I> | Static<J> | Static<K> | Static<L> | Static<M> | Static<N> | Static<O> | Static<P> | Static<Q> | Static<R> | Static<S> | Static<T>;
export declare type Matcher1<A extends Rt, Z> = (x: Static1<A>) => Z;
export declare type Matcher2<A extends Rt, B extends Rt, Z> = (x: Static2<A, B>) => Z;
export declare type Matcher3<A extends Rt, B extends Rt, C extends Rt, Z> = (x: Static3<A, B, C>) => Z;
export declare type Matcher4<A extends Rt, B extends Rt, C extends Rt, D extends Rt, Z> = (x: Static4<A, B, C, D>) => Z;
export declare type Matcher5<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, Z> = (x: Static5<A, B, C, D, E>) => Z;
export declare type Matcher6<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, Z> = (x: Static6<A, B, C, D, E, F>) => Z;
export declare type Matcher7<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, Z> = (x: Static7<A, B, C, D, E, F, G>) => Z;
export declare type Matcher8<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, Z> = (x: Static8<A, B, C, D, E, F, G, H>) => Z;
export declare type Matcher9<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, Z> = (x: Static9<A, B, C, D, E, F, G, H, I>) => 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;
export declare type Matcher12<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, L extends Rt, Z> = (x: Static12<A, B, C, D, E, F, G, H, I, J, K, L>) => Z;
export declare type Matcher13<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, L extends Rt, M extends Rt, Z> = (x: Static13<A, B, C, D, E, F, G, H, I, J, K, L, M>) => Z;
export declare type Matcher14<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, L extends Rt, M extends Rt, N extends Rt, Z> = (x: Static14<A, B, C, D, E, F, G, H, I, J, K, L, M, N>) => Z;
export declare type Matcher15<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, Z> = (x: Static15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>) => Z;
export declare type Matcher16<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Z> = (x: Static16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>) => Z;
export declare type Matcher17<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, Z> = (x: Static17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>) => Z;
export declare type Matcher18<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, Z> = (x: Static18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>) => Z;
export declare type Matcher19<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, S extends Rt, Z> = (x: Static19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>) => Z;
export declare type Matcher20<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, S extends Rt, T extends Rt, Z> = (x: Static20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>) => Z;
export declare type Matcher1<A extends Rt, Z> = (x: Static<A>) => Z;
export declare type Matcher2<A extends Rt, B extends Rt, Z> = (x: Static<A | B>) => Z;
export declare type Matcher3<A extends Rt, B extends Rt, C extends Rt, Z> = (x: Static<A | B | C>) => Z;
export declare type Matcher4<A extends Rt, B extends Rt, C extends Rt, D extends Rt, Z> = (x: Static<A | B | C | D>) => Z;
export declare type Matcher5<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, Z> = (x: Static<A | B | C | D | E>) => Z;
export declare type Matcher6<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, Z> = (x: Static<A | B | C | D | E | F>) => Z;
export declare type Matcher7<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, Z> = (x: Static<A | B | C | D | E | F | G>) => Z;
export declare type Matcher8<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, F extends Rt, G extends Rt, H extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H>) => Z;
export declare type Matcher9<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, Z> = (x: Static<A | B | C | D | E | F | G | H | I>) => 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: Static<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: Static<A | B | C | D | E | F | G | H | I | J | K>) => Z;
export declare type Matcher12<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, L extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L>) => Z;
export declare type Matcher13<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, L extends Rt, M extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M>) => Z;
export declare type Matcher14<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, L extends Rt, M extends Rt, N extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N>) => Z;
export declare type Matcher15<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O>) => Z;
export declare type Matcher16<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P>) => Z;
export declare type Matcher17<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q>) => Z;
export declare type Matcher18<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R>) => Z;
export declare type Matcher19<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, S extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S>) => Z;
export declare type Matcher20<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, L extends Rt, M extends Rt, N extends Rt, O extends Rt, P extends Rt, Q extends Rt, R extends Rt, S extends Rt, T extends Rt, Z> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T>) => Z;
{
"name": "runtypes",
"version": "2.1.6",
"version": "2.2.0",
"description": "Runtime validation for static types",

@@ -17,8 +17,8 @@ "main": "./lib/index.js",

"devDependencies": {
"@types/jest": "22.2.2",
"coveralls": "^3.0.0",
"jest": "22.4.3",
"prettier": "^1.11.1",
"ts-jest": "^22.4.2",
"typescript": "2.8.1"
"@types/jest": "23.3.9",
"coveralls": "^3.0.2",
"jest": "23.6.0",
"prettier": "^1.15.2",
"ts-jest": "^23.10.5",
"typescript": "3.1.6"
},

@@ -43,7 +43,9 @@ "keywords:": [

"transform": {
"\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor"
"\\.ts$": "ts-jest"
},
"testEnvironment": "node"
},
"dependencies": {}
"dependencies": {
"reflect-metadata": "^0.1.12"
}
}

@@ -106,4 +106,4 @@ import {

{ value: false, passes: ['Boolean', 'false'] },
{ value: 3, passes: ['Number', '3', 'union1'] },
{ value: 42, passes: ['Number', '42', 'MoreThanThree', 'MoreThanThreeWithMessage'] },
{ value: 3, passes: ['Number', 3, 'union1'] },
{ value: 42, passes: ['Number', 42, 'MoreThanThree', 'MoreThanThreeWithMessage'] },
{ value: 'hello world', passes: ['String', 'hello world', 'union1'] },

@@ -110,0 +110,0 @@ { value: [Symbol('0'), Symbol(42), Symbol()], passes: ['symbolArray'] },

@@ -26,1 +26,2 @@ export { Runtype, Static } from './runtype';

export { Brand } from './types/brand';
export * from './decorator';

@@ -11,3 +11,3 @@ import { Runtype, create, validationError } from '../runtype';

export const Function = create<Function>(
x => {
(x: any) => {
if (typeof x !== 'function') throw validationError(`Expected function, but was ${typeof x}`);

@@ -14,0 +14,0 @@ return x;

import { Runtype as Rt, Static, create, validationError } from '../runtype';
import show from '../show';
export interface Union1<A extends Rt> extends Rt<Static1<A>> {
export interface Union1<A extends Rt> extends Rt<Static<A>> {
tag: 'union';

@@ -10,3 +10,3 @@ alternatives: [A];

export interface Union2<A extends Rt, B extends Rt> extends Rt<Static2<A, B>> {
export interface Union2<A extends Rt, B extends Rt> extends Rt<Static<A | B>> {
tag: 'union';

@@ -17,3 +17,3 @@ alternatives: [A, B];

export interface Union3<A extends Rt, B extends Rt, C extends Rt> extends Rt<Static3<A, B, C>> {
export interface Union3<A extends Rt, B extends Rt, C extends Rt> extends Rt<Static<A | B | C>> {
tag: 'union';

@@ -1478,424 +1478,10 @@ alternatives: [A, B, C];

export type Static1<A extends Rt> = Static<A>;
export type Static2<A extends Rt, B extends Rt> = Static<A> | Static<B>;
export type Static3<A extends Rt, B extends Rt, C extends Rt> = Static<A> | Static<B> | Static<C>;
export type Static4<A extends Rt, B extends Rt, C extends Rt, D extends Rt> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>;
export type Static5<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>;
export type Static6<
A extends Rt,
B extends Rt,
C extends Rt,
D extends Rt,
E extends Rt,
F extends Rt
> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F>;
export type Static7<
A extends Rt,
B extends Rt,
C extends Rt,
D extends Rt,
E extends Rt,
F extends Rt,
G extends Rt
> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G>;
export type Static8<
A extends Rt,
B extends Rt,
C extends Rt,
D extends Rt,
E extends Rt,
F extends Rt,
G extends Rt,
H extends Rt
> = Static<A> | Static<B> | Static<C> | Static<D> | Static<E> | Static<F> | Static<G> | Static<H>;
export type Static9<
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
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>;
export 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 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 type Static12<
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,
L extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>;
export type Static13<
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,
L extends Rt,
M extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>;
export type Static14<
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,
L extends Rt,
M extends Rt,
N extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>;
export type Static15<
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,
L extends Rt,
M extends Rt,
N extends Rt,
O extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>
| Static<O>;
export type Static16<
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,
L extends Rt,
M extends Rt,
N extends Rt,
O extends Rt,
P extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>
| Static<O>
| Static<P>;
export type Static17<
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,
L extends Rt,
M extends Rt,
N extends Rt,
O extends Rt,
P extends Rt,
Q extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>
| Static<O>
| Static<P>
| Static<Q>;
export type Static18<
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,
L extends Rt,
M extends Rt,
N extends Rt,
O extends Rt,
P extends Rt,
Q extends Rt,
R extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>
| Static<O>
| Static<P>
| Static<Q>
| Static<R>;
export type Static19<
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,
L extends Rt,
M extends Rt,
N extends Rt,
O extends Rt,
P extends Rt,
Q extends Rt,
R extends Rt,
S extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>
| Static<O>
| Static<P>
| Static<Q>
| Static<R>
| Static<S>;
export type Static20<
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,
L extends Rt,
M extends Rt,
N extends Rt,
O extends Rt,
P extends Rt,
Q extends Rt,
R extends Rt,
S extends Rt,
T extends Rt
> =
| Static<A>
| Static<B>
| Static<C>
| Static<D>
| Static<E>
| Static<F>
| Static<G>
| Static<H>
| Static<I>
| Static<J>
| Static<K>
| Static<L>
| Static<M>
| Static<N>
| Static<O>
| Static<P>
| Static<Q>
| Static<R>
| Static<S>
| Static<T>;
export type Matcher1<A extends Rt, Z> = (x: Static1<A>) => Z;
export type Matcher2<A extends Rt, B extends Rt, Z> = (x: Static2<A, B>) => Z;
export type Matcher3<A extends Rt, B extends Rt, C extends Rt, Z> = (x: Static3<A, B, C>) => Z;
export type Matcher1<A extends Rt, Z> = (x: Static<A>) => Z;
export type Matcher2<A extends Rt, B extends Rt, Z> = (x: Static<A | B>) => Z;
export type Matcher3<A extends Rt, B extends Rt, C extends Rt, Z> = (x: Static<A | B | C>) => Z;
export type Matcher4<A extends Rt, B extends Rt, C extends Rt, D extends Rt, Z> = (
x: Static4<A, B, C, D>,
x: Static<A | B | C | D>,
) => Z;
export type Matcher5<A extends Rt, B extends Rt, C extends Rt, D extends Rt, E extends Rt, Z> = (
x: Static5<A, B, C, D, E>,
x: Static<A | B | C | D | E>,
) => Z;

@@ -1910,3 +1496,3 @@ export type Matcher6<

Z
> = (x: Static6<A, B, C, D, E, F>) => Z;
> = (x: Static<A | B | C | D | E | F>) => Z;
export type Matcher7<

@@ -1921,3 +1507,3 @@ A extends Rt,

Z
> = (x: Static7<A, B, C, D, E, F, G>) => Z;
> = (x: Static<A | B | C | D | E | F | G>) => Z;
export type Matcher8<

@@ -1933,3 +1519,3 @@ A extends Rt,

Z
> = (x: Static8<A, B, C, D, E, F, G, H>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H>) => Z;
export type Matcher9<

@@ -1946,3 +1532,3 @@ A extends Rt,

Z
> = (x: Static9<A, B, C, D, E, F, G, H, I>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I>) => Z;
export type Matcher10<

@@ -1960,3 +1546,3 @@ A extends Rt,

Z
> = (x: Static10<A, B, C, D, E, F, G, H, I, J>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J>) => Z;
export type Matcher11<

@@ -1975,3 +1561,3 @@ A extends Rt,

Z
> = (x: Static11<A, B, C, D, E, F, G, H, I, J, K>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K>) => Z;
export type Matcher12<

@@ -1991,3 +1577,3 @@ A extends Rt,

Z
> = (x: Static12<A, B, C, D, E, F, G, H, I, J, K, L>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L>) => Z;
export type Matcher13<

@@ -2008,3 +1594,3 @@ A extends Rt,

Z
> = (x: Static13<A, B, C, D, E, F, G, H, I, J, K, L, M>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M>) => Z;
export type Matcher14<

@@ -2026,3 +1612,3 @@ A extends Rt,

Z
> = (x: Static14<A, B, C, D, E, F, G, H, I, J, K, L, M, N>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N>) => Z;
export type Matcher15<

@@ -2045,3 +1631,3 @@ A extends Rt,

Z
> = (x: Static15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O>) => Z;
export type Matcher16<

@@ -2065,3 +1651,3 @@ A extends Rt,

Z
> = (x: Static16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P>) => Z;
export type Matcher17<

@@ -2086,3 +1672,3 @@ A extends Rt,

Z
> = (x: Static17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q>) => Z;
export type Matcher18<

@@ -2108,3 +1694,3 @@ A extends Rt,

Z
> = (x: Static18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R>) => Z;
export type Matcher19<

@@ -2131,3 +1717,3 @@ A extends Rt,

Z
> = (x: Static19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S>) => Z;
export type Matcher20<

@@ -2155,2 +1741,2 @@ A extends Rt,

Z
> = (x: Static20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>) => Z;
> = (x: Static<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T>) => Z;

@@ -12,5 +12,6 @@ {

"outDir": "lib",
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true
},
"exclude": ["./lib/**/*", "./examples/**/*"]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc