Comparing version 2.2.9 to 2.2.10
@@ -17,2 +17,7 @@ # Changelog | ||
# 2.2.10 | ||
- **Polish** | ||
- expose `fp-ts` modules without lib/es6 prefix, #507 (@osdiab) | ||
# 2.2.9 | ||
@@ -19,0 +24,0 @@ |
@@ -1,5 +0,5 @@ | ||
import { Invariant3 } from 'fp-ts/es6/Invariant'; | ||
import * as D from './Decoder'; | ||
import * as E from './Encoder'; | ||
import { Literal } from './Schemable'; | ||
import { Invariant3 } from 'fp-ts/es6/Invariant' | ||
import * as D from './Decoder' | ||
import * as E from './Encoder' | ||
import { Literal } from './Schemable' | ||
/** | ||
@@ -14,4 +14,3 @@ * Laws: | ||
*/ | ||
export interface Codec<I, O, A> extends D.Decoder<I, A>, E.Encoder<O, A> { | ||
} | ||
export interface Codec<I, O, A> extends D.Decoder<I, A>, E.Encoder<O, A> {} | ||
/** | ||
@@ -21,3 +20,3 @@ * @category constructors | ||
*/ | ||
export declare function make<I, O, A>(decoder: D.Decoder<I, A>, encoder: E.Encoder<O, A>): Codec<I, O, A>; | ||
export declare function make<I, O, A>(decoder: D.Decoder<I, A>, encoder: E.Encoder<O, A>): Codec<I, O, A> | ||
/** | ||
@@ -27,3 +26,3 @@ * @category constructors | ||
*/ | ||
export declare function fromDecoder<I, A>(decoder: D.Decoder<I, A>): Codec<I, A, A>; | ||
export declare function fromDecoder<I, A>(decoder: D.Decoder<I, A>): Codec<I, A, A> | ||
/** | ||
@@ -33,3 +32,5 @@ * @category constructors | ||
*/ | ||
export declare function literal<A extends readonly [Literal, ...Array<Literal>]>(...values: A): Codec<unknown, A[number], A[number]>; | ||
export declare function literal<A extends readonly [Literal, ...Array<Literal>]>( | ||
...values: A | ||
): Codec<unknown, A[number], A[number]> | ||
/** | ||
@@ -39,3 +40,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Codec<unknown, string, string>; | ||
export declare const string: Codec<unknown, string, string> | ||
/** | ||
@@ -45,3 +46,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Codec<unknown, number, number>; | ||
export declare const number: Codec<unknown, number, number> | ||
/** | ||
@@ -51,3 +52,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Codec<unknown, boolean, boolean>; | ||
export declare const boolean: Codec<unknown, boolean, boolean> | ||
/** | ||
@@ -57,3 +58,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Codec<unknown, Array<unknown>, Array<unknown>>; | ||
export declare const UnknownArray: Codec<unknown, Array<unknown>, Array<unknown>> | ||
/** | ||
@@ -63,3 +64,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Codec<unknown, Record<string, unknown>, Record<string, unknown>>; | ||
export declare const UnknownRecord: Codec<unknown, Record<string, unknown>, Record<string, unknown>> | ||
/** | ||
@@ -69,3 +70,5 @@ * @category combinators | ||
*/ | ||
export declare const mapLeftWithInput: <I>(f: (i: I, e: D.DecodeError) => D.DecodeError) => <O, A>(codec: Codec<I, O, A>) => Codec<I, O, A>; | ||
export declare const mapLeftWithInput: <I>( | ||
f: (i: I, e: D.DecodeError) => D.DecodeError | ||
) => <O, A>(codec: Codec<I, O, A>) => Codec<I, O, A> | ||
/** | ||
@@ -75,3 +78,6 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B>; | ||
export declare const refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B> | ||
/** | ||
@@ -81,3 +87,3 @@ * @category combinators | ||
*/ | ||
export declare function nullable<I, O, A>(or: Codec<I, O, A>): Codec<null | I, null | O, null | A>; | ||
export declare function nullable<I, O, A>(or: Codec<I, O, A>): Codec<null | I, null | O, null | A> | ||
/** | ||
@@ -87,9 +93,15 @@ * @category combinators | ||
*/ | ||
export declare function fromType<P extends Record<string, Codec<any, any, any>>>(properties: P): Codec<{ | ||
[K in keyof P]: InputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>; | ||
export declare function fromType<P extends Record<string, Codec<any, any, any>>>( | ||
properties: P | ||
): Codec< | ||
{ | ||
[K in keyof P]: InputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
/** | ||
@@ -99,7 +111,13 @@ * @category combinators | ||
*/ | ||
export declare function type<P extends Record<string, Codec<unknown, any, any>>>(properties: P): Codec<unknown, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>; | ||
export declare function type<P extends Record<string, Codec<unknown, any, any>>>( | ||
properties: P | ||
): Codec< | ||
unknown, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
/** | ||
@@ -109,9 +127,21 @@ * @category combinators | ||
*/ | ||
export declare function fromPartial<P extends Record<string, Codec<any, any, any>>>(properties: P): Codec<Partial<{ | ||
[K in keyof P]: InputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>>; | ||
export declare function fromPartial<P extends Record<string, Codec<any, any, any>>>( | ||
properties: P | ||
): Codec< | ||
Partial< | ||
{ | ||
[K in keyof P]: InputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -121,7 +151,17 @@ * @category combinators | ||
*/ | ||
export declare function partial<P extends Record<string, Codec<unknown, any, any>>>(properties: P): Codec<unknown, Partial<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>>; | ||
export declare function partial<P extends Record<string, Codec<unknown, any, any>>>( | ||
properties: P | ||
): Codec< | ||
unknown, | ||
Partial< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -131,3 +171,3 @@ * @category combinators | ||
*/ | ||
export declare function fromArray<I, O, A>(item: Codec<I, O, A>): Codec<Array<I>, Array<O>, Array<A>>; | ||
export declare function fromArray<I, O, A>(item: Codec<I, O, A>): Codec<Array<I>, Array<O>, Array<A>> | ||
/** | ||
@@ -137,3 +177,3 @@ * @category combinators | ||
*/ | ||
export declare function array<O, A>(item: Codec<unknown, O, A>): Codec<unknown, Array<O>, Array<A>>; | ||
export declare function array<O, A>(item: Codec<unknown, O, A>): Codec<unknown, Array<O>, Array<A>> | ||
/** | ||
@@ -143,3 +183,5 @@ * @category combinators | ||
*/ | ||
export declare function fromRecord<I, O, A>(codomain: Codec<I, O, A>): Codec<Record<string, I>, Record<string, O>, Record<string, A>>; | ||
export declare function fromRecord<I, O, A>( | ||
codomain: Codec<I, O, A> | ||
): Codec<Record<string, I>, Record<string, O>, Record<string, A>> | ||
/** | ||
@@ -149,3 +191,5 @@ * @category combinators | ||
*/ | ||
export declare function record<O, A>(codomain: Codec<unknown, O, A>): Codec<unknown, Record<string, O>, Record<string, A>>; | ||
export declare function record<O, A>( | ||
codomain: Codec<unknown, O, A> | ||
): Codec<unknown, Record<string, O>, Record<string, A>> | ||
/** | ||
@@ -155,3 +199,9 @@ * @category combinators | ||
*/ | ||
export declare const fromTuple: <C extends readonly Codec<any, any, any>[]>(...components: C) => Codec<{ [K in keyof C]: import("./Kleisli").InputOf<"Either", C[K]>; }, { [K_1 in keyof C]: E.OutputOf<C[K_1]>; }, { [K_2 in keyof C]: E.TypeOf<C[K_2]>; }>; | ||
export declare const fromTuple: <C extends readonly Codec<any, any, any>[]>( | ||
...components: C | ||
) => Codec< | ||
{ [K in keyof C]: import('./Kleisli').InputOf<'Either', C[K]> }, | ||
{ [K_1 in keyof C]: E.OutputOf<C[K_1]> }, | ||
{ [K_2 in keyof C]: E.TypeOf<C[K_2]> } | ||
> | ||
/** | ||
@@ -161,7 +211,13 @@ * @category combinators | ||
*/ | ||
export declare function tuple<C extends ReadonlyArray<Codec<unknown, any, any>>>(...components: C): Codec<unknown, { | ||
[K in keyof C]: OutputOf<C[K]>; | ||
}, { | ||
[K in keyof C]: TypeOf<C[K]>; | ||
}>; | ||
export declare function tuple<C extends ReadonlyArray<Codec<unknown, any, any>>>( | ||
...components: C | ||
): Codec< | ||
unknown, | ||
{ | ||
[K in keyof C]: OutputOf<C[K]> | ||
}, | ||
{ | ||
[K in keyof C]: TypeOf<C[K]> | ||
} | ||
> | ||
/** | ||
@@ -171,3 +227,5 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <IB, OB, B>(right: Codec<IB, OB, B>) => <IA, OA, A>(left: Codec<IA, OA, A>) => Codec<IA & IB, OA & OB, A & B>; | ||
export declare const intersect: <IB, OB, B>( | ||
right: Codec<IB, OB, B> | ||
) => <IA, OA, A>(left: Codec<IA, OA, A>) => Codec<IA & IB, OA & OB, A & B> | ||
/** | ||
@@ -177,3 +235,7 @@ * @category combinators | ||
*/ | ||
export declare const fromSum: <T extends string>(tag: T) => <MS extends Record<string, Codec<any, any, any>>>(members: MS) => Codec<import("./Kleisli").InputOf<"Either", MS[keyof MS]>, E.OutputOf<MS[keyof MS]>, E.TypeOf<MS[keyof MS]>>; | ||
export declare const fromSum: <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, Codec<any, any, any>>>( | ||
members: MS | ||
) => Codec<import('./Kleisli').InputOf<'Either', MS[keyof MS]>, E.OutputOf<MS[keyof MS]>, E.TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -183,3 +245,7 @@ * @category combinators | ||
*/ | ||
export declare function sum<T extends string>(tag: T): <M extends Record<string, Codec<unknown, any, any>>>(members: M) => Codec<unknown, OutputOf<M[keyof M]>, TypeOf<M[keyof M]>>; | ||
export declare function sum<T extends string>( | ||
tag: T | ||
): <M extends Record<string, Codec<unknown, any, any>>>( | ||
members: M | ||
) => Codec<unknown, OutputOf<M[keyof M]>, TypeOf<M[keyof M]>> | ||
/** | ||
@@ -189,3 +255,3 @@ * @category combinators | ||
*/ | ||
export declare function lazy<I, O, A>(id: string, f: () => Codec<I, O, A>): Codec<I, O, A>; | ||
export declare function lazy<I, O, A>(id: string, f: () => Codec<I, O, A>): Codec<I, O, A> | ||
/** | ||
@@ -195,3 +261,5 @@ * @category combinators | ||
*/ | ||
export declare const compose: <L, A extends L, P extends A, B>(to: Codec<L, P, B>) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B>; | ||
export declare const compose: <L, A extends L, P extends A, B>( | ||
to: Codec<L, P, B> | ||
) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B> | ||
/** | ||
@@ -201,3 +269,3 @@ * @category Invariant | ||
*/ | ||
export declare const imap: <I, O, A, B>(f: (a: A) => B, g: (b: B) => A) => (fa: Codec<I, O, A>) => Codec<I, O, B>; | ||
export declare const imap: <I, O, A, B>(f: (a: A) => B, g: (b: B) => A) => (fa: Codec<I, O, A>) => Codec<I, O, B> | ||
/** | ||
@@ -207,3 +275,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Codec"; | ||
export declare const URI = 'io-ts/Codec' | ||
/** | ||
@@ -213,7 +281,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind3<R, E, A> { | ||
readonly [URI]: Codec<R, E, A>; | ||
} | ||
interface URItoKind3<R, E, A> { | ||
readonly [URI]: Codec<R, E, A> | ||
} | ||
} | ||
@@ -224,14 +292,14 @@ /** | ||
*/ | ||
export declare const Invariant: Invariant3<URI>; | ||
export declare const Invariant: Invariant3<URI> | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<C> = D.InputOf<C>; | ||
export declare type InputOf<C> = D.InputOf<C> | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type OutputOf<C> = E.OutputOf<C>; | ||
export declare type OutputOf<C> = E.OutputOf<C> | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type TypeOf<C> = E.TypeOf<C>; | ||
export declare type TypeOf<C> = E.TypeOf<C> |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import { Semigroup } from 'fp-ts/es6/Semigroup'; | ||
import * as FS from './FreeSemigroup'; | ||
import { Semigroup } from 'fp-ts/es6/Semigroup' | ||
import * as FS from './FreeSemigroup' | ||
/** | ||
@@ -19,5 +19,5 @@ * @category model | ||
export interface Leaf<E> { | ||
readonly _tag: 'Leaf'; | ||
readonly actual: unknown; | ||
readonly error: E; | ||
readonly _tag: 'Leaf' | ||
readonly actual: unknown | ||
readonly error: E | ||
} | ||
@@ -28,3 +28,3 @@ /** | ||
*/ | ||
export declare const required: 'required'; | ||
export declare const required: 'required' | ||
/** | ||
@@ -34,3 +34,3 @@ * @category model | ||
*/ | ||
export declare const optional: 'optional'; | ||
export declare const optional: 'optional' | ||
/** | ||
@@ -40,3 +40,3 @@ * @category model | ||
*/ | ||
export declare type Kind = 'required' | 'optional'; | ||
export declare type Kind = 'required' | 'optional' | ||
/** | ||
@@ -47,6 +47,6 @@ * @category model | ||
export interface Key<E> { | ||
readonly _tag: 'Key'; | ||
readonly key: string; | ||
readonly kind: Kind; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Key' | ||
readonly key: string | ||
readonly kind: Kind | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -58,6 +58,6 @@ /** | ||
export interface Index<E> { | ||
readonly _tag: 'Index'; | ||
readonly index: number; | ||
readonly kind: Kind; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Index' | ||
readonly index: number | ||
readonly kind: Kind | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -69,5 +69,5 @@ /** | ||
export interface Member<E> { | ||
readonly _tag: 'Member'; | ||
readonly index: number; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Member' | ||
readonly index: number | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -79,5 +79,5 @@ /** | ||
export interface Lazy<E> { | ||
readonly _tag: 'Lazy'; | ||
readonly id: string; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Lazy' | ||
readonly id: string | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -89,5 +89,5 @@ /** | ||
export interface Wrap<E> { | ||
readonly _tag: 'Wrap'; | ||
readonly error: E; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Wrap' | ||
readonly error: E | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -98,3 +98,3 @@ /** | ||
*/ | ||
export declare type DecodeError<E> = Leaf<E> | Key<E> | Index<E> | Member<E> | Lazy<E> | Wrap<E>; | ||
export declare type DecodeError<E> = Leaf<E> | Key<E> | Index<E> | Member<E> | Lazy<E> | Wrap<E> | ||
/** | ||
@@ -104,3 +104,3 @@ * @category constructors | ||
*/ | ||
export declare const leaf: <E>(actual: unknown, error: E) => DecodeError<E>; | ||
export declare const leaf: <E>(actual: unknown, error: E) => DecodeError<E> | ||
/** | ||
@@ -110,3 +110,3 @@ * @category constructors | ||
*/ | ||
export declare const key: <E>(key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const key: <E>(key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -116,3 +116,3 @@ * @category constructors | ||
*/ | ||
export declare const index: <E>(index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const index: <E>(index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -122,3 +122,3 @@ * @category constructors | ||
*/ | ||
export declare const member: <E>(index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const member: <E>(index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -128,3 +128,3 @@ * @category constructors | ||
*/ | ||
export declare const lazy: <E>(id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const lazy: <E>(id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -134,3 +134,3 @@ * @category constructors | ||
*/ | ||
export declare const wrap: <E>(error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const wrap: <E>(error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -141,9 +141,9 @@ * @category destructors | ||
export declare const fold: <E, R>(patterns: { | ||
Leaf: (input: unknown, error: E) => R; | ||
Key: (key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Index: (index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Member: (index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Lazy: (id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Wrap: (error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
}) => (e: DecodeError<E>) => R; | ||
Leaf: (input: unknown, error: E) => R | ||
Key: (key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Index: (index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Member: (index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Lazy: (id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Wrap: (error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
}) => (e: DecodeError<E>) => R | ||
/** | ||
@@ -153,2 +153,2 @@ * @category instances | ||
*/ | ||
export declare function getSemigroup<E = never>(): Semigroup<FS.FreeSemigroup<DecodeError<E>>>; | ||
export declare function getSemigroup<E = never>(): Semigroup<FS.FreeSemigroup<DecodeError<E>>> |
@@ -11,12 +11,12 @@ /** | ||
*/ | ||
import { Alt2 } from 'fp-ts/es6/Alt'; | ||
import { Category2 } from 'fp-ts/es6/Category'; | ||
import * as E from 'fp-ts/es6/Either'; | ||
import { Refinement } from 'fp-ts/es6/function'; | ||
import { Functor2 } from 'fp-ts/es6/Functor'; | ||
import * as DE from './DecodeError'; | ||
import * as FS from './FreeSemigroup'; | ||
import * as G from './Guard'; | ||
import * as K from './Kleisli'; | ||
import * as S from './Schemable'; | ||
import { Alt2 } from 'fp-ts/es6/Alt' | ||
import { Category2 } from 'fp-ts/es6/Category' | ||
import * as E from 'fp-ts/es6/Either' | ||
import { Refinement } from 'fp-ts/es6/function' | ||
import { Functor2 } from 'fp-ts/es6/Functor' | ||
import * as DE from './DecodeError' | ||
import * as FS from './FreeSemigroup' | ||
import * as G from './Guard' | ||
import * as K from './Kleisli' | ||
import * as S from './Schemable' | ||
/** | ||
@@ -26,4 +26,3 @@ * @category model | ||
*/ | ||
export interface Decoder<I, A> extends K.Kleisli<E.URI, I, DecodeError, A> { | ||
} | ||
export interface Decoder<I, A> extends K.Kleisli<E.URI, I, DecodeError, A> {} | ||
/** | ||
@@ -33,3 +32,3 @@ * @category DecodeError | ||
*/ | ||
export declare type DecodeError = FS.FreeSemigroup<DE.DecodeError<string>>; | ||
export declare type DecodeError = FS.FreeSemigroup<DE.DecodeError<string>> | ||
/** | ||
@@ -39,3 +38,3 @@ * @category DecodeError | ||
*/ | ||
export declare const error: (actual: unknown, message: string) => DecodeError; | ||
export declare const error: (actual: unknown, message: string) => DecodeError | ||
/** | ||
@@ -45,3 +44,3 @@ * @category DecodeError | ||
*/ | ||
export declare const success: <A>(a: A) => E.Either<DecodeError, A>; | ||
export declare const success: <A>(a: A) => E.Either<DecodeError, A> | ||
/** | ||
@@ -51,3 +50,6 @@ * @category DecodeError | ||
*/ | ||
export declare const failure: <A = never>(actual: unknown, message: string) => E.Either<FS.FreeSemigroup<DE.DecodeError<string>>, A>; | ||
export declare const failure: <A = never>( | ||
actual: unknown, | ||
message: string | ||
) => E.Either<FS.FreeSemigroup<DE.DecodeError<string>>, A> | ||
/** | ||
@@ -57,3 +59,3 @@ * @category constructors | ||
*/ | ||
export declare const fromRefinement: <I, A extends I>(refinement: Refinement<I, A>, expected: string) => Decoder<I, A>; | ||
export declare const fromRefinement: <I, A extends I>(refinement: Refinement<I, A>, expected: string) => Decoder<I, A> | ||
/** | ||
@@ -63,3 +65,3 @@ * @category constructors | ||
*/ | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => Decoder<I, A>; | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => Decoder<I, A> | ||
/** | ||
@@ -69,3 +71,5 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>(...values: A) => Decoder<unknown, A[number]>; | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>( | ||
...values: A | ||
) => Decoder<unknown, A[number]> | ||
/** | ||
@@ -75,3 +79,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Decoder<unknown, string>; | ||
export declare const string: Decoder<unknown, string> | ||
/** | ||
@@ -81,3 +85,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Decoder<unknown, number>; | ||
export declare const number: Decoder<unknown, number> | ||
/** | ||
@@ -87,3 +91,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Decoder<unknown, boolean>; | ||
export declare const boolean: Decoder<unknown, boolean> | ||
/** | ||
@@ -93,3 +97,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Decoder<unknown, Array<unknown>>; | ||
export declare const UnknownArray: Decoder<unknown, Array<unknown>> | ||
/** | ||
@@ -99,3 +103,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Decoder<unknown, Record<string, unknown>>; | ||
export declare const UnknownRecord: Decoder<unknown, Record<string, unknown>> | ||
/** | ||
@@ -105,3 +109,5 @@ * @category combinators | ||
*/ | ||
export declare const mapLeftWithInput: <I>(f: (input: I, e: DecodeError) => DecodeError) => <A>(decoder: Decoder<I, A>) => Decoder<I, A>; | ||
export declare const mapLeftWithInput: <I>( | ||
f: (input: I, e: DecodeError) => DecodeError | ||
) => <A>(decoder: Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -111,3 +117,5 @@ * @category combinators | ||
*/ | ||
export declare const withMessage: <I>(message: (input: I, e: DecodeError) => string) => <A>(decoder: Decoder<I, A>) => Decoder<I, A>; | ||
export declare const withMessage: <I>( | ||
message: (input: I, e: DecodeError) => string | ||
) => <A>(decoder: Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -117,3 +125,6 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => <I>(from: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => <I>(from: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -123,3 +134,5 @@ * @category combinators | ||
*/ | ||
export declare const parse: <A, B>(parser: (a: A) => E.Either<DecodeError, B>) => <I>(from: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const parse: <A, B>( | ||
parser: (a: A) => E.Either<DecodeError, B> | ||
) => <I>(from: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -129,3 +142,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <I, A>(or: Decoder<I, A>) => Decoder<null | I, null | A>; | ||
export declare const nullable: <I, A>(or: Decoder<I, A>) => Decoder<null | I, null | A> | ||
/** | ||
@@ -135,3 +148,5 @@ * @category combinators | ||
*/ | ||
export declare const fromType: <P extends Record<string, Decoder<any, any>>>(properties: P) => Decoder<{ [K in keyof P]: K.InputOf<"Either", P[K]>; }, { [K_1 in keyof P]: K.TypeOf<"Either", P[K_1]>; }>; | ||
export declare const fromType: <P extends Record<string, Decoder<any, any>>>( | ||
properties: P | ||
) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> | ||
/** | ||
@@ -141,3 +156,5 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, { [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>( | ||
properties: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -147,3 +164,8 @@ * @category combinators | ||
*/ | ||
export declare const fromPartial: <P extends Record<string, Decoder<any, any>>>(properties: P) => Decoder<Partial<{ [K in keyof P]: K.InputOf<"Either", P[K]>; }>, Partial<{ [K_1 in keyof P]: K.TypeOf<"Either", P[K_1]>; }>>; | ||
export declare const fromPartial: <P extends Record<string, Decoder<any, any>>>( | ||
properties: P | ||
) => Decoder< | ||
Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, | ||
Partial<{ [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> | ||
> | ||
/** | ||
@@ -153,3 +175,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -159,3 +183,3 @@ * @category combinators | ||
*/ | ||
export declare const fromArray: <I, A>(item: Decoder<I, A>) => Decoder<I[], A[]>; | ||
export declare const fromArray: <I, A>(item: Decoder<I, A>) => Decoder<I[], A[]> | ||
/** | ||
@@ -165,3 +189,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: Decoder<unknown, A>) => Decoder<unknown, A[]>; | ||
export declare const array: <A>(item: Decoder<unknown, A>) => Decoder<unknown, A[]> | ||
/** | ||
@@ -171,3 +195,3 @@ * @category combinators | ||
*/ | ||
export declare const fromRecord: <I, A>(codomain: Decoder<I, A>) => Decoder<Record<string, I>, Record<string, A>>; | ||
export declare const fromRecord: <I, A>(codomain: Decoder<I, A>) => Decoder<Record<string, I>, Record<string, A>> | ||
/** | ||
@@ -177,3 +201,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Decoder<unknown, A>) => Decoder<unknown, Record<string, A>>; | ||
export declare const record: <A>(codomain: Decoder<unknown, A>) => Decoder<unknown, Record<string, A>> | ||
/** | ||
@@ -183,3 +207,5 @@ * @category combinators | ||
*/ | ||
export declare const fromTuple: <C extends readonly Decoder<any, any>[]>(...components: C) => Decoder<{ [K in keyof C]: K.InputOf<"Either", C[K]>; }, { [K_1 in keyof C]: K.TypeOf<"Either", C[K_1]>; }>; | ||
export declare const fromTuple: <C extends readonly Decoder<any, any>[]>( | ||
...components: C | ||
) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K_1 in keyof C]: K.TypeOf<'Either', C[K_1]> }> | ||
/** | ||
@@ -189,3 +215,5 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, A>; | ||
export declare const tuple: <A extends readonly unknown[]>( | ||
...components: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, A> | ||
/** | ||
@@ -195,3 +223,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <MS extends readonly [Decoder<any, any>, ...Array<Decoder<any, any>>]>(...members: MS) => Decoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>>; | ||
export declare const union: <MS extends readonly [Decoder<any, any>, ...Array<Decoder<any, any>>]>( | ||
...members: MS | ||
) => Decoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -201,3 +231,5 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <IB, B>(right: Decoder<IB, B>) => <IA, A>(left: Decoder<IA, A>) => Decoder<IA & IB, A & B>; | ||
export declare const intersect: <IB, B>( | ||
right: Decoder<IB, B> | ||
) => <IA, A>(left: Decoder<IA, A>) => Decoder<IA & IB, A & B> | ||
/** | ||
@@ -207,3 +239,7 @@ * @category combinators | ||
*/ | ||
export declare const fromSum: <T extends string>(tag: T) => <MS extends Record<string, Decoder<any, any>>>(members: MS) => Decoder<K.InputOf<"Either", MS[keyof MS]>, K.TypeOf<"Either", MS[keyof MS]>>; | ||
export declare const fromSum: <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, Decoder<any, any>>>( | ||
members: MS | ||
) => Decoder<K.InputOf<'Either', MS[keyof MS]>, K.TypeOf<'Either', MS[keyof MS]>> | ||
/** | ||
@@ -213,3 +249,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(tag: T) => <A>(members: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
tag: T | ||
) => <A>(members: { [K in keyof A]: Decoder<unknown, A[K]> }) => Decoder<unknown, A[keyof A]> | ||
/** | ||
@@ -219,3 +257,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <I, A>(id: string, f: () => Decoder<I, A>) => Decoder<I, A>; | ||
export declare const lazy: <I, A>(id: string, f: () => Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -225,3 +263,3 @@ * @category Functor | ||
*/ | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -231,3 +269,3 @@ * @category Alt | ||
*/ | ||
export declare const alt: <I, A>(that: () => Decoder<I, A>) => (me: Decoder<I, A>) => Decoder<I, A>; | ||
export declare const alt: <I, A>(that: () => Decoder<I, A>) => (me: Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -237,3 +275,3 @@ * @category Semigroupoid | ||
*/ | ||
export declare const compose: <A, B>(to: Decoder<A, B>) => <I>(from: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const compose: <A, B>(to: Decoder<A, B>) => <I>(from: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -243,3 +281,3 @@ * @category Category | ||
*/ | ||
export declare const id: <A>() => Decoder<A, A>; | ||
export declare const id: <A>() => Decoder<A, A> | ||
/** | ||
@@ -249,3 +287,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Decoder"; | ||
export declare const URI = 'io-ts/Decoder' | ||
/** | ||
@@ -255,7 +293,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Decoder<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Decoder<E, A> | ||
} | ||
} | ||
@@ -266,3 +304,3 @@ /** | ||
*/ | ||
export declare const Functor: Functor2<URI>; | ||
export declare const Functor: Functor2<URI> | ||
/** | ||
@@ -272,3 +310,3 @@ * @category instances | ||
*/ | ||
export declare const Alt: Alt2<URI>; | ||
export declare const Alt: Alt2<URI> | ||
/** | ||
@@ -278,3 +316,3 @@ * @category instances | ||
*/ | ||
export declare const Category: Category2<URI>; | ||
export declare const Category: Category2<URI> | ||
/** | ||
@@ -284,3 +322,3 @@ * @category instances | ||
*/ | ||
export declare const Schemable: S.Schemable2C<URI, unknown>; | ||
export declare const Schemable: S.Schemable2C<URI, unknown> | ||
/** | ||
@@ -290,3 +328,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown>; | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown> | ||
/** | ||
@@ -296,3 +334,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown>; | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown> | ||
/** | ||
@@ -302,14 +340,14 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown>; | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown> | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<D> = K.InputOf<E.URI, D>; | ||
export declare type InputOf<D> = K.InputOf<E.URI, D> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type TypeOf<D> = K.TypeOf<E.URI, D>; | ||
export declare type TypeOf<D> = K.TypeOf<E.URI, D> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare const draw: (e: DecodeError) => string; | ||
export declare const draw: (e: DecodeError) => string |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import { Contravariant2 } from 'fp-ts/es6/Contravariant'; | ||
import { Category2 } from 'fp-ts/es6/Category'; | ||
import { Contravariant2 } from 'fp-ts/es6/Contravariant' | ||
import { Category2 } from 'fp-ts/es6/Category' | ||
/** | ||
@@ -19,3 +19,3 @@ * @category model | ||
export interface Encoder<O, A> { | ||
readonly encode: (a: A) => O; | ||
readonly encode: (a: A) => O | ||
} | ||
@@ -26,3 +26,3 @@ /** | ||
*/ | ||
export declare function nullable<O, A>(or: Encoder<O, A>): Encoder<null | O, null | A>; | ||
export declare function nullable<O, A>(or: Encoder<O, A>): Encoder<null | O, null | A> | ||
/** | ||
@@ -32,7 +32,12 @@ * @category combinators | ||
*/ | ||
export declare function type<P extends Record<string, Encoder<any, any>>>(properties: P): Encoder<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>; | ||
export declare function type<P extends Record<string, Encoder<any, any>>>( | ||
properties: P | ||
): Encoder< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
/** | ||
@@ -42,7 +47,16 @@ * @category combinators | ||
*/ | ||
export declare function partial<P extends Record<string, Encoder<any, any>>>(properties: P): Encoder<Partial<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>>; | ||
export declare function partial<P extends Record<string, Encoder<any, any>>>( | ||
properties: P | ||
): Encoder< | ||
Partial< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -52,3 +66,3 @@ * @category combinators | ||
*/ | ||
export declare function record<O, A>(codomain: Encoder<O, A>): Encoder<Record<string, O>, Record<string, A>>; | ||
export declare function record<O, A>(codomain: Encoder<O, A>): Encoder<Record<string, O>, Record<string, A>> | ||
/** | ||
@@ -58,3 +72,3 @@ * @category combinators | ||
*/ | ||
export declare function array<O, A>(item: Encoder<O, A>): Encoder<Array<O>, Array<A>>; | ||
export declare function array<O, A>(item: Encoder<O, A>): Encoder<Array<O>, Array<A>> | ||
/** | ||
@@ -64,7 +78,12 @@ * @category combinators | ||
*/ | ||
export declare function tuple<C extends ReadonlyArray<Encoder<any, any>>>(...components: C): Encoder<{ | ||
[K in keyof C]: OutputOf<C[K]>; | ||
}, { | ||
[K in keyof C]: TypeOf<C[K]>; | ||
}>; | ||
export declare function tuple<C extends ReadonlyArray<Encoder<any, any>>>( | ||
...components: C | ||
): Encoder< | ||
{ | ||
[K in keyof C]: OutputOf<C[K]> | ||
}, | ||
{ | ||
[K in keyof C]: TypeOf<C[K]> | ||
} | ||
> | ||
/** | ||
@@ -74,3 +93,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <P, B>(right: Encoder<P, B>) => <O, A>(left: Encoder<O, A>) => Encoder<O & P, A & B>; | ||
export declare const intersect: <P, B>(right: Encoder<P, B>) => <O, A>(left: Encoder<O, A>) => Encoder<O & P, A & B> | ||
/** | ||
@@ -80,3 +99,5 @@ * @category combinators | ||
*/ | ||
export declare function sum<T extends string>(tag: T): <MS extends Record<string, Encoder<any, any>>>(members: MS) => Encoder<OutputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>>; | ||
export declare function sum<T extends string>( | ||
tag: T | ||
): <MS extends Record<string, Encoder<any, any>>>(members: MS) => Encoder<OutputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -86,3 +107,3 @@ * @category combinators | ||
*/ | ||
export declare function lazy<O, A>(f: () => Encoder<O, A>): Encoder<O, A>; | ||
export declare function lazy<O, A>(f: () => Encoder<O, A>): Encoder<O, A> | ||
/** | ||
@@ -92,3 +113,3 @@ * @category Contravariant | ||
*/ | ||
export declare const contramap: <A, B>(f: (b: B) => A) => <E>(fa: Encoder<E, A>) => Encoder<E, B>; | ||
export declare const contramap: <A, B>(f: (b: B) => A) => <E>(fa: Encoder<E, A>) => Encoder<E, B> | ||
/** | ||
@@ -98,3 +119,3 @@ * @category Semigroupoid | ||
*/ | ||
export declare const compose: <E, A>(ea: Encoder<E, A>) => <B>(ab: Encoder<A, B>) => Encoder<E, B>; | ||
export declare const compose: <E, A>(ea: Encoder<E, A>) => <B>(ab: Encoder<A, B>) => Encoder<E, B> | ||
/** | ||
@@ -104,3 +125,3 @@ * @category Category | ||
*/ | ||
export declare function id<A>(): Encoder<A, A>; | ||
export declare function id<A>(): Encoder<A, A> | ||
/** | ||
@@ -110,3 +131,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Encoder"; | ||
export declare const URI = 'io-ts/Encoder' | ||
/** | ||
@@ -116,7 +137,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Encoder<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Encoder<E, A> | ||
} | ||
} | ||
@@ -127,3 +148,3 @@ /** | ||
*/ | ||
export declare const Contravariant: Contravariant2<URI>; | ||
export declare const Contravariant: Contravariant2<URI> | ||
/** | ||
@@ -133,10 +154,10 @@ * @category instances | ||
*/ | ||
export declare const Category: Category2<URI>; | ||
export declare const Category: Category2<URI> | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type TypeOf<E> = E extends Encoder<any, infer A> ? A : never; | ||
export declare type TypeOf<E> = E extends Encoder<any, infer A> ? A : never | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type OutputOf<E> = E extends Encoder<infer O, any> ? O : never; | ||
export declare type OutputOf<E> = E extends Encoder<infer O, any> ? O : never |
@@ -1,12 +0,12 @@ | ||
import * as E from 'fp-ts/es6/Eq'; | ||
import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable'; | ||
import Eq = E.Eq; | ||
import * as E from 'fp-ts/es6/Eq' | ||
import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' | ||
import Eq = E.Eq | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type URI = E.URI; | ||
export declare type URI = E.URI | ||
/** | ||
* @since 2.2.2 | ||
*/ | ||
export declare type TypeOf<E> = E extends Eq<infer A> ? A : never; | ||
export declare type TypeOf<E> = E extends Eq<infer A> ? A : never | ||
/** | ||
@@ -16,3 +16,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Eq<string>; | ||
export declare const string: Eq<string> | ||
/** | ||
@@ -22,3 +22,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Eq<number>; | ||
export declare const number: Eq<number> | ||
/** | ||
@@ -28,3 +28,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Eq<boolean>; | ||
export declare const boolean: Eq<boolean> | ||
/** | ||
@@ -34,3 +34,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Eq<Array<unknown>>; | ||
export declare const UnknownArray: Eq<Array<unknown>> | ||
/** | ||
@@ -40,3 +40,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Eq<Record<string, unknown>>; | ||
export declare const UnknownRecord: Eq<Record<string, unknown>> | ||
/** | ||
@@ -46,3 +46,3 @@ * @category combinators | ||
*/ | ||
export declare function nullable<A>(or: Eq<A>): Eq<null | A>; | ||
export declare function nullable<A>(or: Eq<A>): Eq<null | A> | ||
/** | ||
@@ -52,7 +52,11 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(eqs: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}) => Eq<{ | ||
[K in keyof A]: A[K]; | ||
}>; | ||
export declare const type: <A>( | ||
eqs: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
) => Eq< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
/** | ||
@@ -62,7 +66,13 @@ * @category combinators | ||
*/ | ||
export declare function partial<A>(properties: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}): Eq<Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
export declare function partial<A>( | ||
properties: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
): Eq< | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
/** | ||
@@ -72,3 +82,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Eq<A>) => Eq<Record<string, A>>; | ||
export declare const record: <A>(codomain: Eq<A>) => Eq<Record<string, A>> | ||
/** | ||
@@ -78,3 +88,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(eq: Eq<A>) => Eq<Array<A>>; | ||
export declare const array: <A>(eq: Eq<A>) => Eq<Array<A>> | ||
/** | ||
@@ -84,5 +94,7 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}) => Eq<A>; | ||
export declare const tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
) => Eq<A> | ||
/** | ||
@@ -92,3 +104,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <B>(right: E.Eq<B>) => <A>(left: E.Eq<A>) => E.Eq<A & B>; | ||
export declare const intersect: <B>(right: E.Eq<B>) => <A>(left: E.Eq<A>) => E.Eq<A & B> | ||
/** | ||
@@ -98,5 +110,9 @@ * @category combinators | ||
*/ | ||
export declare function sum<T extends string>(tag: T): <A>(members: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}) => Eq<A[keyof A]>; | ||
export declare function sum<T extends string>( | ||
tag: T | ||
): <A>( | ||
members: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
) => Eq<A[keyof A]> | ||
/** | ||
@@ -106,3 +122,3 @@ * @category combinators | ||
*/ | ||
export declare function lazy<A>(f: () => Eq<A>): Eq<A>; | ||
export declare function lazy<A>(f: () => Eq<A>): Eq<A> | ||
/** | ||
@@ -112,3 +128,3 @@ * @category instances | ||
*/ | ||
export declare const Schemable: Schemable1<E.URI>; | ||
export declare const Schemable: Schemable1<E.URI> | ||
/** | ||
@@ -118,3 +134,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: WithUnknownContainers1<E.URI>; | ||
export declare const WithUnknownContainers: WithUnknownContainers1<E.URI> | ||
/** | ||
@@ -124,2 +140,2 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: WithRefine1<E.URI>; | ||
export declare const WithRefine: WithRefine1<E.URI> |
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
import { Semigroup } from 'fp-ts/es6/Semigroup'; | ||
import { Semigroup } from 'fp-ts/es6/Semigroup' | ||
/** | ||
@@ -18,4 +18,4 @@ * @category model | ||
export interface Of<A> { | ||
readonly _tag: 'Of'; | ||
readonly value: A; | ||
readonly _tag: 'Of' | ||
readonly value: A | ||
} | ||
@@ -27,5 +27,5 @@ /** | ||
export interface Concat<A> { | ||
readonly _tag: 'Concat'; | ||
readonly left: FreeSemigroup<A>; | ||
readonly right: FreeSemigroup<A>; | ||
readonly _tag: 'Concat' | ||
readonly left: FreeSemigroup<A> | ||
readonly right: FreeSemigroup<A> | ||
} | ||
@@ -36,3 +36,3 @@ /** | ||
*/ | ||
export declare type FreeSemigroup<A> = Of<A> | Concat<A>; | ||
export declare type FreeSemigroup<A> = Of<A> | Concat<A> | ||
/** | ||
@@ -42,3 +42,3 @@ * @category constructors | ||
*/ | ||
export declare const of: <A>(a: A) => FreeSemigroup<A>; | ||
export declare const of: <A>(a: A) => FreeSemigroup<A> | ||
/** | ||
@@ -48,3 +48,3 @@ * @category constructors | ||
*/ | ||
export declare const concat: <A>(left: FreeSemigroup<A>, right: FreeSemigroup<A>) => FreeSemigroup<A>; | ||
export declare const concat: <A>(left: FreeSemigroup<A>, right: FreeSemigroup<A>) => FreeSemigroup<A> | ||
/** | ||
@@ -54,3 +54,6 @@ * @category destructors | ||
*/ | ||
export declare const fold: <A, R>(onOf: (value: A) => R, onConcat: (left: FreeSemigroup<A>, right: FreeSemigroup<A>) => R) => (f: FreeSemigroup<A>) => R; | ||
export declare const fold: <A, R>( | ||
onOf: (value: A) => R, | ||
onConcat: (left: FreeSemigroup<A>, right: FreeSemigroup<A>) => R | ||
) => (f: FreeSemigroup<A>) => R | ||
/** | ||
@@ -60,2 +63,2 @@ * @category instances | ||
*/ | ||
export declare function getSemigroup<A = never>(): Semigroup<FreeSemigroup<A>>; | ||
export declare function getSemigroup<A = never>(): Semigroup<FreeSemigroup<A>> |
@@ -1,2 +0,2 @@ | ||
import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable'; | ||
import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' | ||
/** | ||
@@ -7,3 +7,3 @@ * @category model | ||
export interface Guard<I, A extends I> { | ||
is: (i: I) => i is A; | ||
is: (i: I) => i is A | ||
} | ||
@@ -13,7 +13,7 @@ /** | ||
*/ | ||
export declare type TypeOf<G> = G extends Guard<any, infer A> ? A : never; | ||
export declare type TypeOf<G> = G extends Guard<any, infer A> ? A : never | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<G> = G extends Guard<infer I, any> ? I : never; | ||
export declare type InputOf<G> = G extends Guard<infer I, any> ? I : never | ||
/** | ||
@@ -23,3 +23,3 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Guard<unknown, A[number]>; | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Guard<unknown, A[number]> | ||
/** | ||
@@ -29,3 +29,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Guard<unknown, string>; | ||
export declare const string: Guard<unknown, string> | ||
/** | ||
@@ -37,3 +37,3 @@ * Note: `NaN` is excluded. | ||
*/ | ||
export declare const number: Guard<unknown, number>; | ||
export declare const number: Guard<unknown, number> | ||
/** | ||
@@ -43,3 +43,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Guard<unknown, boolean>; | ||
export declare const boolean: Guard<unknown, boolean> | ||
/** | ||
@@ -49,3 +49,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Guard<unknown, Array<unknown>>; | ||
export declare const UnknownArray: Guard<unknown, Array<unknown>> | ||
/** | ||
@@ -55,3 +55,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Guard<unknown, Record<string, unknown>>; | ||
export declare const UnknownRecord: Guard<unknown, Record<string, unknown>> | ||
/** | ||
@@ -61,3 +61,5 @@ * @category combinators | ||
*/ | ||
export declare const refine: <I, A extends I, B extends A>(refinement: (a: A) => a is B) => (from: Guard<I, A>) => Guard<I, B>; | ||
export declare const refine: <I, A extends I, B extends A>( | ||
refinement: (a: A) => a is B | ||
) => (from: Guard<I, A>) => Guard<I, B> | ||
/** | ||
@@ -67,3 +69,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <I, A extends I>(or: Guard<I, A>) => Guard<I | null, A | null>; | ||
export declare const nullable: <I, A extends I>(or: Guard<I, A>) => Guard<I | null, A | null> | ||
/** | ||
@@ -73,3 +75,5 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, { [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>( | ||
properties: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -79,3 +83,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -85,3 +91,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: Guard<unknown, A>) => Guard<unknown, A[]>; | ||
export declare const array: <A>(item: Guard<unknown, A>) => Guard<unknown, A[]> | ||
/** | ||
@@ -91,3 +97,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Guard<unknown, A>) => Guard<unknown, Record<string, A>>; | ||
export declare const record: <A>(codomain: Guard<unknown, A>) => Guard<unknown, Record<string, A>> | ||
/** | ||
@@ -97,3 +103,5 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, A>; | ||
export declare const tuple: <A extends readonly unknown[]>( | ||
...components: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, A> | ||
/** | ||
@@ -103,3 +111,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <B>(right: Guard<unknown, B>) => <A>(left: Guard<unknown, A>) => Guard<unknown, A & B>; | ||
export declare const intersect: <B>(right: Guard<unknown, B>) => <A>(left: Guard<unknown, A>) => Guard<unknown, A & B> | ||
/** | ||
@@ -109,3 +117,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>(...members: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, A[number]>; | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>( | ||
...members: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, A[number]> | ||
/** | ||
@@ -115,3 +125,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(tag: T) => <A>(members: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
tag: T | ||
) => <A>(members: { [K in keyof A]: Guard<unknown, A[K]> }) => Guard<unknown, A[keyof A]> | ||
/** | ||
@@ -121,3 +133,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <A>(f: () => Guard<unknown, A>) => Guard<unknown, A>; | ||
export declare const lazy: <A>(f: () => Guard<unknown, A>) => Guard<unknown, A> | ||
/** | ||
@@ -127,3 +139,3 @@ * @category combinators | ||
*/ | ||
export declare const alt: <I, A extends I>(that: () => Guard<I, A>) => (me: Guard<I, A>) => Guard<I, A>; | ||
export declare const alt: <I, A extends I>(that: () => Guard<I, A>) => (me: Guard<I, A>) => Guard<I, A> | ||
/** | ||
@@ -133,3 +145,3 @@ * @category combinators | ||
*/ | ||
export declare const zero: <I, A extends I>() => Guard<I, A>; | ||
export declare const zero: <I, A extends I>() => Guard<I, A> | ||
/** | ||
@@ -139,3 +151,3 @@ * @category combinators | ||
*/ | ||
export declare const compose: <I, A extends I, B extends A>(to: Guard<A, B>) => (from: Guard<I, A>) => Guard<I, B>; | ||
export declare const compose: <I, A extends I, B extends A>(to: Guard<A, B>) => (from: Guard<I, A>) => Guard<I, B> | ||
/** | ||
@@ -145,3 +157,3 @@ * @category combinators | ||
*/ | ||
export declare const id: <A>() => Guard<A, A>; | ||
export declare const id: <A>() => Guard<A, A> | ||
/** | ||
@@ -151,3 +163,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Guard"; | ||
export declare const URI = 'io-ts/Guard' | ||
/** | ||
@@ -157,7 +169,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind<A> { | ||
readonly [URI]: Guard<unknown, A>; | ||
} | ||
interface URItoKind<A> { | ||
readonly [URI]: Guard<unknown, A> | ||
} | ||
} | ||
@@ -168,3 +180,3 @@ /** | ||
*/ | ||
export declare const Schemable: Schemable1<URI>; | ||
export declare const Schemable: Schemable1<URI> | ||
/** | ||
@@ -174,3 +186,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI>; | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI> | ||
/** | ||
@@ -180,3 +192,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: WithUnion1<URI>; | ||
export declare const WithUnion: WithUnion1<URI> | ||
/** | ||
@@ -186,2 +198,2 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: WithRefine1<URI>; | ||
export declare const WithRefine: WithRefine1<URI> |
1256
es6/index.d.ts
/** | ||
* @since 1.0.0 | ||
*/ | ||
import { Either } from 'fp-ts/es6/Either'; | ||
import { Predicate, Refinement } from 'fp-ts/es6/function'; | ||
import { Either } from 'fp-ts/es6/Either' | ||
import { Predicate, Refinement } from 'fp-ts/es6/function' | ||
/** | ||
@@ -11,6 +11,6 @@ * @category Model | ||
export interface ContextEntry { | ||
readonly key: string; | ||
readonly type: Decoder<any, any>; | ||
/** the input data */ | ||
readonly actual?: unknown; | ||
readonly key: string | ||
readonly type: Decoder<any, any> | ||
/** the input data */ | ||
readonly actual?: unknown | ||
} | ||
@@ -21,4 +21,3 @@ /** | ||
*/ | ||
export interface Context extends ReadonlyArray<ContextEntry> { | ||
} | ||
export interface Context extends ReadonlyArray<ContextEntry> {} | ||
/** | ||
@@ -29,8 +28,8 @@ * @category Model | ||
export interface ValidationError { | ||
/** the offending (sub)value */ | ||
readonly value: unknown; | ||
/** where the error originated */ | ||
readonly context: Context; | ||
/** optional custom error message */ | ||
readonly message?: string; | ||
/** the offending (sub)value */ | ||
readonly value: unknown | ||
/** where the error originated */ | ||
readonly context: Context | ||
/** optional custom error message */ | ||
readonly message?: string | ||
} | ||
@@ -41,4 +40,3 @@ /** | ||
*/ | ||
export interface Errors extends Array<ValidationError> { | ||
} | ||
export interface Errors extends Array<ValidationError> {} | ||
/** | ||
@@ -48,3 +46,3 @@ * @category Model | ||
*/ | ||
export declare type Validation<A> = Either<Errors, A>; | ||
export declare type Validation<A> = Either<Errors, A> | ||
/** | ||
@@ -54,3 +52,3 @@ * @category Model | ||
*/ | ||
export declare type Is<A> = (u: unknown) => u is A; | ||
export declare type Is<A> = (u: unknown) => u is A | ||
/** | ||
@@ -60,3 +58,3 @@ * @category Model | ||
*/ | ||
export declare type Validate<I, A> = (i: I, context: Context) => Validation<A>; | ||
export declare type Validate<I, A> = (i: I, context: Context) => Validation<A> | ||
/** | ||
@@ -66,3 +64,3 @@ * @category Model | ||
*/ | ||
export declare type Decode<I, A> = (i: I) => Validation<A>; | ||
export declare type Decode<I, A> = (i: I) => Validation<A> | ||
/** | ||
@@ -72,25 +70,23 @@ * @category Model | ||
*/ | ||
export declare type Encode<A, O> = (a: A) => O; | ||
export declare type Encode<A, O> = (a: A) => O | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export interface Any extends Type<any, any, any> { | ||
} | ||
export interface Any extends Type<any, any, any> {} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export interface Mixed extends Type<any, any, unknown> { | ||
} | ||
export interface Mixed extends Type<any, any, unknown> {} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare type TypeOf<C extends Any> = C['_A']; | ||
export declare type TypeOf<C extends Any> = C['_A'] | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare type InputOf<C extends Any> = C['_I']; | ||
export declare type InputOf<C extends Any> = C['_I'] | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare type OutputOf<C extends Any> = C['_O']; | ||
export declare type OutputOf<C extends Any> = C['_O'] | ||
/** | ||
@@ -101,5 +97,5 @@ * @category Model | ||
export interface Decoder<I, A> { | ||
readonly name: string; | ||
readonly validate: Validate<I, A>; | ||
readonly decode: Decode<I, A>; | ||
readonly name: string | ||
readonly validate: Validate<I, A> | ||
readonly decode: Decode<I, A> | ||
} | ||
@@ -111,3 +107,3 @@ /** | ||
export interface Encoder<A, O> { | ||
readonly encode: Encode<A, O>; | ||
readonly encode: Encode<A, O> | ||
} | ||
@@ -119,48 +115,49 @@ /** | ||
export declare class Type<A, O = A, I = unknown> implements Decoder<I, A>, Encoder<A, O> { | ||
/** a unique name for this codec */ | ||
readonly name: string | ||
/** a custom type guard */ | ||
readonly is: Is<A> | ||
/** succeeds if a value of type I can be decoded to a value of type A */ | ||
readonly validate: Validate<I, A> | ||
/** converts a value of type A to a value of type O */ | ||
readonly encode: Encode<A, O> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _A: A | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _O: O | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _I: I | ||
constructor( | ||
/** a unique name for this codec */ | ||
readonly name: string; | ||
name: string, | ||
/** a custom type guard */ | ||
readonly is: Is<A>; | ||
is: Is<A>, | ||
/** succeeds if a value of type I can be decoded to a value of type A */ | ||
readonly validate: Validate<I, A>; | ||
validate: Validate<I, A>, | ||
/** converts a value of type A to a value of type O */ | ||
readonly encode: Encode<A, O>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _A: A; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _O: O; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _I: I; | ||
constructor( | ||
/** a unique name for this codec */ | ||
name: string, | ||
/** a custom type guard */ | ||
is: Is<A>, | ||
/** succeeds if a value of type I can be decoded to a value of type A */ | ||
validate: Validate<I, A>, | ||
/** converts a value of type A to a value of type O */ | ||
encode: Encode<A, O>); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
pipe<B, IB, A extends IB, OB extends A>(this: Type<A, O, I>, ab: Type<B, OB, IB>, name?: string): Type<B, O, I>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asDecoder(): Decoder<I, A>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asEncoder(): Encoder<A, O>; | ||
/** | ||
* a version of `validate` with a default context | ||
* @since 1.0.0 | ||
*/ | ||
decode(i: I): Validation<A>; | ||
encode: Encode<A, O> | ||
) | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
pipe<B, IB, A extends IB, OB extends A>(this: Type<A, O, I>, ab: Type<B, OB, IB>, name?: string): Type<B, O, I> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asDecoder(): Decoder<I, A> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asEncoder(): Encoder<A, O> | ||
/** | ||
* a version of `validate` with a default context | ||
* @since 1.0.0 | ||
*/ | ||
decode(i: I): Validation<A> | ||
} | ||
@@ -170,27 +167,27 @@ /** | ||
*/ | ||
export declare const identity: <A>(a: A) => A; | ||
export declare const identity: <A>(a: A) => A | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const getFunctionName: (f: Function) => string; | ||
export declare const getFunctionName: (f: Function) => string | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const getContextEntry: (key: string, decoder: Decoder<any, any>) => ContextEntry; | ||
export declare const getContextEntry: (key: string, decoder: Decoder<any, any>) => ContextEntry | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const appendContext: (c: Context, key: string, decoder: Decoder<any, any>, actual?: unknown) => Context; | ||
export declare const appendContext: (c: Context, key: string, decoder: Decoder<any, any>, actual?: unknown) => Context | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const failures: <T>(errors: Errors) => Validation<T>; | ||
export declare const failures: <T>(errors: Errors) => Validation<T> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const failure: <T>(value: unknown, context: Context, message?: string | undefined) => Either<Errors, T>; | ||
export declare const failure: <T>(value: unknown, context: Context, message?: string | undefined) => Either<Errors, T> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const success: <T>(value: T) => Validation<T>; | ||
export declare const success: <T>(value: T) => Validation<T> | ||
/** | ||
@@ -200,7 +197,7 @@ * @since 1.0.0 | ||
export declare class NullType extends Type<null> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NullType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NullType' | ||
constructor() | ||
} | ||
@@ -210,4 +207,3 @@ /** | ||
*/ | ||
export interface NullC extends NullType { | ||
} | ||
export interface NullC extends NullType {} | ||
/** | ||
@@ -217,3 +213,3 @@ * @category Primitives | ||
*/ | ||
export declare const nullType: NullC; | ||
export declare const nullType: NullC | ||
/** | ||
@@ -223,7 +219,7 @@ * @since 1.0.0 | ||
export declare class UndefinedType extends Type<undefined> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UndefinedType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UndefinedType' | ||
constructor() | ||
} | ||
@@ -233,5 +229,4 @@ /** | ||
*/ | ||
export interface UndefinedC extends UndefinedType { | ||
} | ||
declare const undefinedType: UndefinedC; | ||
export interface UndefinedC extends UndefinedType {} | ||
declare const undefinedType: UndefinedC | ||
/** | ||
@@ -241,7 +236,7 @@ * @since 1.2.0 | ||
export declare class VoidType extends Type<void> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'VoidType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'VoidType' | ||
constructor() | ||
} | ||
@@ -251,4 +246,3 @@ /** | ||
*/ | ||
export interface VoidC extends VoidType { | ||
} | ||
export interface VoidC extends VoidType {} | ||
/** | ||
@@ -258,3 +252,3 @@ * @category Primitives | ||
*/ | ||
export declare const voidType: VoidC; | ||
export declare const voidType: VoidC | ||
/** | ||
@@ -264,7 +258,7 @@ * @since 1.5.0 | ||
export declare class UnknownType extends Type<unknown> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnknownType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnknownType' | ||
constructor() | ||
} | ||
@@ -274,4 +268,3 @@ /** | ||
*/ | ||
export interface UnknownC extends UnknownType { | ||
} | ||
export interface UnknownC extends UnknownType {} | ||
/** | ||
@@ -281,3 +274,3 @@ * @category Primitives | ||
*/ | ||
export declare const unknown: UnknownC; | ||
export declare const unknown: UnknownC | ||
/** | ||
@@ -287,7 +280,7 @@ * @since 1.0.0 | ||
export declare class StringType extends Type<string> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StringType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StringType' | ||
constructor() | ||
} | ||
@@ -297,4 +290,3 @@ /** | ||
*/ | ||
export interface StringC extends StringType { | ||
} | ||
export interface StringC extends StringType {} | ||
/** | ||
@@ -304,3 +296,3 @@ * @category Primitives | ||
*/ | ||
export declare const string: StringC; | ||
export declare const string: StringC | ||
/** | ||
@@ -310,7 +302,7 @@ * @since 1.0.0 | ||
export declare class NumberType extends Type<number> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NumberType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NumberType' | ||
constructor() | ||
} | ||
@@ -320,4 +312,3 @@ /** | ||
*/ | ||
export interface NumberC extends NumberType { | ||
} | ||
export interface NumberC extends NumberType {} | ||
/** | ||
@@ -327,3 +318,3 @@ * @category Primitives | ||
*/ | ||
export declare const number: NumberC; | ||
export declare const number: NumberC | ||
/** | ||
@@ -333,7 +324,7 @@ * @since 2.1.0 | ||
export declare class BigIntType extends Type<bigint> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BigIntType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BigIntType' | ||
constructor() | ||
} | ||
@@ -343,4 +334,3 @@ /** | ||
*/ | ||
export interface BigIntC extends BigIntType { | ||
} | ||
export interface BigIntC extends BigIntType {} | ||
/** | ||
@@ -350,3 +340,3 @@ * @category Primitives | ||
*/ | ||
export declare const bigint: BigIntC; | ||
export declare const bigint: BigIntC | ||
/** | ||
@@ -356,7 +346,7 @@ * @since 1.0.0 | ||
export declare class BooleanType extends Type<boolean> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BooleanType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BooleanType' | ||
constructor() | ||
} | ||
@@ -366,4 +356,3 @@ /** | ||
*/ | ||
export interface BooleanC extends BooleanType { | ||
} | ||
export interface BooleanC extends BooleanType {} | ||
/** | ||
@@ -373,3 +362,3 @@ * @category Primitives | ||
*/ | ||
export declare const boolean: BooleanC; | ||
export declare const boolean: BooleanC | ||
/** | ||
@@ -379,7 +368,7 @@ * @since 1.0.0 | ||
export declare class AnyArrayType extends Type<Array<unknown>> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyArrayType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyArrayType' | ||
constructor() | ||
} | ||
@@ -389,4 +378,3 @@ /** | ||
*/ | ||
export interface UnknownArrayC extends AnyArrayType { | ||
} | ||
export interface UnknownArrayC extends AnyArrayType {} | ||
/** | ||
@@ -396,3 +384,3 @@ * @category Primitives | ||
*/ | ||
export declare const UnknownArray: UnknownArrayC; | ||
export declare const UnknownArray: UnknownArrayC | ||
/** | ||
@@ -402,9 +390,9 @@ * @since 1.0.0 | ||
export declare class AnyDictionaryType extends Type<{ | ||
[key: string]: unknown; | ||
[key: string]: unknown | ||
}> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyDictionaryType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyDictionaryType' | ||
constructor() | ||
} | ||
@@ -415,8 +403,7 @@ /** | ||
*/ | ||
export declare const UnknownRecord: UnknownRecordC; | ||
export declare const UnknownRecord: UnknownRecordC | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface UnknownRecordC extends AnyDictionaryType { | ||
} | ||
export interface UnknownRecordC extends AnyDictionaryType {} | ||
/** | ||
@@ -428,7 +415,7 @@ * @category deprecated | ||
export declare class FunctionType extends Type<Function> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'FunctionType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'FunctionType' | ||
constructor() | ||
} | ||
@@ -440,4 +427,3 @@ /** | ||
*/ | ||
export interface FunctionC extends FunctionType { | ||
} | ||
export interface FunctionC extends FunctionType {} | ||
/** | ||
@@ -448,3 +434,3 @@ * @category deprecated | ||
*/ | ||
export declare const Function: FunctionC; | ||
export declare const Function: FunctionC | ||
/** | ||
@@ -454,11 +440,18 @@ * @since 1.0.0 | ||
export declare class RefinementType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
readonly predicate: Predicate<A>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RefinementType'; | ||
constructor(name: string, is: RefinementType<C, A, O, I>['is'], validate: RefinementType<C, A, O, I>['validate'], encode: RefinementType<C, A, O, I>['encode'], type: C, predicate: Predicate<A>); | ||
readonly type: C | ||
readonly predicate: Predicate<A> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RefinementType' | ||
constructor( | ||
name: string, | ||
is: RefinementType<C, A, O, I>['is'], | ||
validate: RefinementType<C, A, O, I>['validate'], | ||
encode: RefinementType<C, A, O, I>['encode'], | ||
type: C, | ||
predicate: Predicate<A> | ||
) | ||
} | ||
declare const _brand: unique symbol; | ||
declare const _brand: unique symbol | ||
/** | ||
@@ -468,3 +461,3 @@ * @since 1.8.1 | ||
export interface Brand<B> { | ||
readonly [_brand]: B; | ||
readonly [_brand]: B | ||
} | ||
@@ -474,8 +467,7 @@ /** | ||
*/ | ||
export declare type Branded<A, B> = A & Brand<B>; | ||
export declare type Branded<A, B> = A & Brand<B> | ||
/** | ||
* @since 1.8.1 | ||
*/ | ||
export interface BrandC<C extends Any, B> extends RefinementType<C, Branded<TypeOf<C>, B>, OutputOf<C>, InputOf<C>> { | ||
} | ||
export interface BrandC<C extends Any, B> extends RefinementType<C, Branded<TypeOf<C>, B>, OutputOf<C>, InputOf<C>> {} | ||
/** | ||
@@ -485,3 +477,7 @@ * @category Combinators | ||
*/ | ||
export declare const brand: <C extends Any, N extends string, B extends { readonly [K in N]: symbol; }>(codec: C, predicate: Refinement<C["_A"], Branded<C["_A"], B>>, name: N) => BrandC<C, B>; | ||
export declare const brand: <C extends Any, N extends string, B extends { readonly [K in N]: symbol }>( | ||
codec: C, | ||
predicate: Refinement<C['_A'], Branded<C['_A'], B>>, | ||
name: N | ||
) => BrandC<C, B> | ||
/** | ||
@@ -491,3 +487,3 @@ * @since 1.8.1 | ||
export interface IntBrand { | ||
readonly Int: unique symbol; | ||
readonly Int: unique symbol | ||
} | ||
@@ -500,8 +496,8 @@ /** | ||
*/ | ||
export declare const Int: BrandC<NumberC, IntBrand>; | ||
export declare const Int: BrandC<NumberC, IntBrand> | ||
/** | ||
* @since 1.8.1 | ||
*/ | ||
export declare type Int = Branded<number, IntBrand>; | ||
declare type LiteralValue = string | number | boolean; | ||
export declare type Int = Branded<number, IntBrand> | ||
declare type LiteralValue = string | number | boolean | ||
/** | ||
@@ -511,8 +507,14 @@ * @since 1.0.0 | ||
export declare class LiteralType<V extends LiteralValue> extends Type<V> { | ||
readonly value: V; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'LiteralType'; | ||
constructor(name: string, is: LiteralType<V>['is'], validate: LiteralType<V>['validate'], encode: LiteralType<V>['encode'], value: V); | ||
readonly value: V | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'LiteralType' | ||
constructor( | ||
name: string, | ||
is: LiteralType<V>['is'], | ||
validate: LiteralType<V>['validate'], | ||
encode: LiteralType<V>['encode'], | ||
value: V | ||
) | ||
} | ||
@@ -522,4 +524,3 @@ /** | ||
*/ | ||
export interface LiteralC<V extends LiteralValue> extends LiteralType<V> { | ||
} | ||
export interface LiteralC<V extends LiteralValue> extends LiteralType<V> {} | ||
/** | ||
@@ -529,15 +530,23 @@ * @category Combinators | ||
*/ | ||
export declare const literal: <V extends string | number | boolean>(value: V, name?: string) => LiteralC<V>; | ||
export declare const literal: <V extends string | number | boolean>(value: V, name?: string) => LiteralC<V> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare class KeyofType<D extends { | ||
[key: string]: unknown; | ||
}> extends Type<keyof D> { | ||
readonly keys: D; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'KeyofType'; | ||
constructor(name: string, is: KeyofType<D>['is'], validate: KeyofType<D>['validate'], encode: KeyofType<D>['encode'], keys: D); | ||
export declare class KeyofType< | ||
D extends { | ||
[key: string]: unknown | ||
} | ||
> extends Type<keyof D> { | ||
readonly keys: D | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'KeyofType' | ||
constructor( | ||
name: string, | ||
is: KeyofType<D>['is'], | ||
validate: KeyofType<D>['validate'], | ||
encode: KeyofType<D>['encode'], | ||
keys: D | ||
) | ||
} | ||
@@ -547,6 +556,7 @@ /** | ||
*/ | ||
export interface KeyofC<D extends { | ||
[key: string]: unknown; | ||
}> extends KeyofType<D> { | ||
} | ||
export interface KeyofC< | ||
D extends { | ||
[key: string]: unknown | ||
} | ||
> extends KeyofType<D> {} | ||
/** | ||
@@ -557,4 +567,7 @@ * @category Combinators | ||
export declare const keyof: <D extends { | ||
[key: string]: unknown; | ||
}>(keys: D, name?: string) => KeyofC<D>; | ||
[key: string]: unknown | ||
}>( | ||
keys: D, | ||
name?: string | ||
) => KeyofC<D> | ||
/** | ||
@@ -564,12 +577,18 @@ * @since 1.0.0 | ||
export declare class RecursiveType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
runDefinition: () => C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RecursiveType'; | ||
constructor(name: string, is: RecursiveType<C, A, O, I>['is'], validate: RecursiveType<C, A, O, I>['validate'], encode: RecursiveType<C, A, O, I>['encode'], runDefinition: () => C); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly type: C; | ||
runDefinition: () => C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RecursiveType' | ||
constructor( | ||
name: string, | ||
is: RecursiveType<C, A, O, I>['is'], | ||
validate: RecursiveType<C, A, O, I>['validate'], | ||
encode: RecursiveType<C, A, O, I>['encode'], | ||
runDefinition: () => C | ||
) | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly type: C | ||
} | ||
@@ -580,3 +599,6 @@ /** | ||
*/ | ||
export declare const recursion: <A, O = A, I = unknown, C extends Type<A, O, I> = Type<A, O, I>>(name: string, definition: (self: C) => C) => RecursiveType<C, A, O, I>; | ||
export declare const recursion: <A, O = A, I = unknown, C extends Type<A, O, I> = Type<A, O, I>>( | ||
name: string, | ||
definition: (self: C) => C | ||
) => RecursiveType<C, A, O, I> | ||
/** | ||
@@ -586,8 +608,14 @@ * @since 1.0.0 | ||
export declare class ArrayType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ArrayType'; | ||
constructor(name: string, is: ArrayType<C, A, O, I>['is'], validate: ArrayType<C, A, O, I>['validate'], encode: ArrayType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ArrayType' | ||
constructor( | ||
name: string, | ||
is: ArrayType<C, A, O, I>['is'], | ||
validate: ArrayType<C, A, O, I>['validate'], | ||
encode: ArrayType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -597,4 +625,3 @@ /** | ||
*/ | ||
export interface ArrayC<C extends Mixed> extends ArrayType<C, Array<TypeOf<C>>, Array<OutputOf<C>>, unknown> { | ||
} | ||
export interface ArrayC<C extends Mixed> extends ArrayType<C, Array<TypeOf<C>>, Array<OutputOf<C>>, unknown> {} | ||
/** | ||
@@ -604,3 +631,3 @@ * @category Combinators | ||
*/ | ||
export declare const array: <C extends Mixed>(item: C, name?: string) => ArrayC<C>; | ||
export declare const array: <C extends Mixed>(item: C, name?: string) => ArrayC<C> | ||
/** | ||
@@ -610,8 +637,14 @@ * @since 1.0.0 | ||
export declare class InterfaceType<P, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly props: P; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'InterfaceType'; | ||
constructor(name: string, is: InterfaceType<P, A, O, I>['is'], validate: InterfaceType<P, A, O, I>['validate'], encode: InterfaceType<P, A, O, I>['encode'], props: P); | ||
readonly props: P | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'InterfaceType' | ||
constructor( | ||
name: string, | ||
is: InterfaceType<P, A, O, I>['is'], | ||
validate: InterfaceType<P, A, O, I>['validate'], | ||
encode: InterfaceType<P, A, O, I>['encode'], | ||
props: P | ||
) | ||
} | ||
@@ -622,3 +655,3 @@ /** | ||
export interface AnyProps { | ||
[key: string]: Any; | ||
[key: string]: Any | ||
} | ||
@@ -629,4 +662,4 @@ /** | ||
export declare type TypeOfProps<P extends AnyProps> = { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}; | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
/** | ||
@@ -636,4 +669,4 @@ * @since 1.0.0 | ||
export declare type OutputOfProps<P extends AnyProps> = { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}; | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
/** | ||
@@ -643,3 +676,3 @@ * @since 1.0.0 | ||
export interface Props { | ||
[key: string]: Mixed; | ||
[key: string]: Mixed | ||
} | ||
@@ -649,8 +682,13 @@ /** | ||
*/ | ||
export interface TypeC<P extends Props> extends InterfaceType<P, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, unknown> { | ||
} | ||
export interface TypeC<P extends Props> | ||
extends InterfaceType< | ||
P, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -660,3 +698,3 @@ * @category Combinators | ||
*/ | ||
export declare const type: <P extends Props>(props: P, name?: string) => TypeC<P>; | ||
export declare const type: <P extends Props>(props: P, name?: string) => TypeC<P> | ||
/** | ||
@@ -666,8 +704,14 @@ * @since 1.0.0 | ||
export declare class PartialType<P, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly props: P; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'PartialType'; | ||
constructor(name: string, is: PartialType<P, A, O, I>['is'], validate: PartialType<P, A, O, I>['validate'], encode: PartialType<P, A, O, I>['encode'], props: P); | ||
readonly props: P | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'PartialType' | ||
constructor( | ||
name: string, | ||
is: PartialType<P, A, O, I>['is'], | ||
validate: PartialType<P, A, O, I>['validate'], | ||
encode: PartialType<P, A, O, I>['encode'], | ||
props: P | ||
) | ||
} | ||
@@ -678,4 +722,4 @@ /** | ||
export declare type TypeOfPartialProps<P extends AnyProps> = { | ||
[K in keyof P]?: TypeOf<P[K]>; | ||
}; | ||
[K in keyof P]?: TypeOf<P[K]> | ||
} | ||
/** | ||
@@ -685,13 +729,18 @@ * @since 1.0.0 | ||
export declare type OutputOfPartialProps<P extends AnyProps> = { | ||
[K in keyof P]?: OutputOf<P[K]>; | ||
}; | ||
[K in keyof P]?: OutputOf<P[K]> | ||
} | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface PartialC<P extends Props> extends PartialType<P, { | ||
[K in keyof P]?: TypeOf<P[K]>; | ||
}, { | ||
[K in keyof P]?: OutputOf<P[K]>; | ||
}, unknown> { | ||
} | ||
export interface PartialC<P extends Props> | ||
extends PartialType< | ||
P, | ||
{ | ||
[K in keyof P]?: TypeOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]?: OutputOf<P[K]> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -701,3 +750,3 @@ * @category Combinators | ||
*/ | ||
export declare const partial: <P extends Props>(props: P, name?: string) => PartialC<P>; | ||
export declare const partial: <P extends Props>(props: P, name?: string) => PartialC<P> | ||
/** | ||
@@ -707,9 +756,16 @@ * @since 1.0.0 | ||
export declare class DictionaryType<D extends Any, C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly domain: D; | ||
readonly codomain: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'DictionaryType'; | ||
constructor(name: string, is: DictionaryType<D, C, A, O, I>['is'], validate: DictionaryType<D, C, A, O, I>['validate'], encode: DictionaryType<D, C, A, O, I>['encode'], domain: D, codomain: C); | ||
readonly domain: D | ||
readonly codomain: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'DictionaryType' | ||
constructor( | ||
name: string, | ||
is: DictionaryType<D, C, A, O, I>['is'], | ||
validate: DictionaryType<D, C, A, O, I>['validate'], | ||
encode: DictionaryType<D, C, A, O, I>['encode'], | ||
domain: D, | ||
codomain: C | ||
) | ||
} | ||
@@ -720,4 +776,4 @@ /** | ||
export declare type TypeOfDictionary<D extends Any, C extends Any> = { | ||
[K in TypeOf<D>]: TypeOf<C>; | ||
}; | ||
[K in TypeOf<D>]: TypeOf<C> | ||
} | ||
/** | ||
@@ -727,13 +783,19 @@ * @since 1.0.0 | ||
export declare type OutputOfDictionary<D extends Any, C extends Any> = { | ||
[K in OutputOf<D>]: OutputOf<C>; | ||
}; | ||
[K in OutputOf<D>]: OutputOf<C> | ||
} | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface RecordC<D extends Mixed, C extends Mixed> extends DictionaryType<D, C, { | ||
[K in TypeOf<D>]: TypeOf<C>; | ||
}, { | ||
[K in OutputOf<D>]: OutputOf<C>; | ||
}, unknown> { | ||
} | ||
export interface RecordC<D extends Mixed, C extends Mixed> | ||
extends DictionaryType< | ||
D, | ||
C, | ||
{ | ||
[K in TypeOf<D>]: TypeOf<C> | ||
}, | ||
{ | ||
[K in OutputOf<D>]: OutputOf<C> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -743,3 +805,3 @@ * @category Combinators | ||
*/ | ||
export declare function record<D extends Mixed, C extends Mixed>(domain: D, codomain: C, name?: string): RecordC<D, C>; | ||
export declare function record<D extends Mixed, C extends Mixed>(domain: D, codomain: C, name?: string): RecordC<D, C> | ||
/** | ||
@@ -749,8 +811,14 @@ * @since 1.0.0 | ||
export declare class UnionType<CS extends Array<Any>, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly types: CS; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnionType'; | ||
constructor(name: string, is: UnionType<CS, A, O, I>['is'], validate: UnionType<CS, A, O, I>['validate'], encode: UnionType<CS, A, O, I>['encode'], types: CS); | ||
readonly types: CS | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnionType' | ||
constructor( | ||
name: string, | ||
is: UnionType<CS, A, O, I>['is'], | ||
validate: UnionType<CS, A, O, I>['validate'], | ||
encode: UnionType<CS, A, O, I>['encode'], | ||
types: CS | ||
) | ||
} | ||
@@ -760,4 +828,4 @@ /** | ||
*/ | ||
export interface UnionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> extends UnionType<CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> { | ||
} | ||
export interface UnionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> | ||
extends UnionType<CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> {} | ||
/** | ||
@@ -767,3 +835,3 @@ * @category Combinators | ||
*/ | ||
export declare const union: <CS extends [Mixed, Mixed, ...Mixed[]]>(codecs: CS, name?: string) => UnionC<CS>; | ||
export declare const union: <CS extends [Mixed, Mixed, ...Mixed[]]>(codecs: CS, name?: string) => UnionC<CS> | ||
/** | ||
@@ -773,8 +841,14 @@ * @since 1.0.0 | ||
export declare class IntersectionType<CS extends Array<Any>, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly types: CS; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'IntersectionType'; | ||
constructor(name: string, is: IntersectionType<CS, A, O, I>['is'], validate: IntersectionType<CS, A, O, I>['validate'], encode: IntersectionType<CS, A, O, I>['encode'], types: CS); | ||
readonly types: CS | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'IntersectionType' | ||
constructor( | ||
name: string, | ||
is: IntersectionType<CS, A, O, I>['is'], | ||
validate: IntersectionType<CS, A, O, I>['validate'], | ||
encode: IntersectionType<CS, A, O, I>['encode'], | ||
types: CS | ||
) | ||
} | ||
@@ -784,20 +858,41 @@ /** | ||
*/ | ||
export interface IntersectionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> extends IntersectionType<CS, CS extends { | ||
length: 2; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> : CS extends { | ||
length: 3; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> : CS extends { | ||
length: 4; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> : CS extends { | ||
length: 5; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> & TypeOf<CS[4]> : unknown, CS extends { | ||
length: 2; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> : CS extends { | ||
length: 3; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> : CS extends { | ||
length: 4; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> : CS extends { | ||
length: 5; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> & OutputOf<CS[4]> : unknown, unknown> { | ||
} | ||
export interface IntersectionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> | ||
extends IntersectionType< | ||
CS, | ||
CS extends { | ||
length: 2 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> | ||
: CS extends { | ||
length: 3 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> | ||
: CS extends { | ||
length: 4 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> | ||
: CS extends { | ||
length: 5 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> & TypeOf<CS[4]> | ||
: unknown, | ||
CS extends { | ||
length: 2 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> | ||
: CS extends { | ||
length: 3 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> | ||
: CS extends { | ||
length: 4 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> | ||
: CS extends { | ||
length: 5 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> & OutputOf<CS[4]> | ||
: unknown, | ||
unknown | ||
> {} | ||
/** | ||
@@ -807,6 +902,21 @@ * @category Combinators | ||
*/ | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed, E extends Mixed>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]>; | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>(codecs: [A, B, C, D], name?: string): IntersectionC<[A, B, C, D]>; | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed>(codecs: [A, B, C], name?: string): IntersectionC<[A, B, C]>; | ||
export declare function intersection<A extends Mixed, B extends Mixed>(codecs: [A, B], name?: string): IntersectionC<[A, B]>; | ||
export declare function intersection< | ||
A extends Mixed, | ||
B extends Mixed, | ||
C extends Mixed, | ||
D extends Mixed, | ||
E extends Mixed | ||
>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>( | ||
codecs: [A, B, C, D], | ||
name?: string | ||
): IntersectionC<[A, B, C, D]> | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed>( | ||
codecs: [A, B, C], | ||
name?: string | ||
): IntersectionC<[A, B, C]> | ||
export declare function intersection<A extends Mixed, B extends Mixed>( | ||
codecs: [A, B], | ||
name?: string | ||
): IntersectionC<[A, B]> | ||
/** | ||
@@ -816,8 +926,14 @@ * @since 1.0.0 | ||
export declare class TupleType<CS extends Array<Any>, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly types: CS; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'TupleType'; | ||
constructor(name: string, is: TupleType<CS, A, O, I>['is'], validate: TupleType<CS, A, O, I>['validate'], encode: TupleType<CS, A, O, I>['encode'], types: CS); | ||
readonly types: CS | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'TupleType' | ||
constructor( | ||
name: string, | ||
is: TupleType<CS, A, O, I>['is'], | ||
validate: TupleType<CS, A, O, I>['validate'], | ||
encode: TupleType<CS, A, O, I>['encode'], | ||
types: CS | ||
) | ||
} | ||
@@ -827,24 +943,49 @@ /** | ||
*/ | ||
export interface TupleC<CS extends [Mixed, ...Array<Mixed>]> extends TupleType<CS, CS extends { | ||
length: 1; | ||
} ? [TypeOf<CS[0]>] : CS extends { | ||
length: 2; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>] : CS extends { | ||
length: 3; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>] : CS extends { | ||
length: 4; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>] : CS extends { | ||
length: 5; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>, TypeOf<CS[4]>] : unknown, CS extends { | ||
length: 1; | ||
} ? [OutputOf<CS[0]>] : CS extends { | ||
length: 2; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>] : CS extends { | ||
length: 3; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>] : CS extends { | ||
length: 4; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>] : CS extends { | ||
length: 5; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>, OutputOf<CS[4]>] : unknown, unknown> { | ||
} | ||
export interface TupleC<CS extends [Mixed, ...Array<Mixed>]> | ||
extends TupleType< | ||
CS, | ||
CS extends { | ||
length: 1 | ||
} | ||
? [TypeOf<CS[0]>] | ||
: CS extends { | ||
length: 2 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>] | ||
: CS extends { | ||
length: 3 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>] | ||
: CS extends { | ||
length: 4 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>] | ||
: CS extends { | ||
length: 5 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>, TypeOf<CS[4]>] | ||
: unknown, | ||
CS extends { | ||
length: 1 | ||
} | ||
? [OutputOf<CS[0]>] | ||
: CS extends { | ||
length: 2 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>] | ||
: CS extends { | ||
length: 3 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>] | ||
: CS extends { | ||
length: 4 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>] | ||
: CS extends { | ||
length: 5 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>, OutputOf<CS[4]>] | ||
: unknown, | ||
unknown | ||
> {} | ||
/** | ||
@@ -854,7 +995,16 @@ * @category Combinators | ||
*/ | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed, E extends Mixed>(codecs: [A, B, C, D, E], name?: string): TupleC<[A, B, C, D, E]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>(codecs: [A, B, C, D], name?: string): TupleC<[A, B, C, D]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed>(codecs: [A, B, C], name?: string): TupleC<[A, B, C]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed>(codecs: [A, B], name?: string): TupleC<[A, B]>; | ||
export declare function tuple<A extends Mixed>(codecs: [A], name?: string): TupleC<[A]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed, E extends Mixed>( | ||
codecs: [A, B, C, D, E], | ||
name?: string | ||
): TupleC<[A, B, C, D, E]> | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>( | ||
codecs: [A, B, C, D], | ||
name?: string | ||
): TupleC<[A, B, C, D]> | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed>( | ||
codecs: [A, B, C], | ||
name?: string | ||
): TupleC<[A, B, C]> | ||
export declare function tuple<A extends Mixed, B extends Mixed>(codecs: [A, B], name?: string): TupleC<[A, B]> | ||
export declare function tuple<A extends Mixed>(codecs: [A], name?: string): TupleC<[A]> | ||
/** | ||
@@ -864,8 +1014,14 @@ * @since 1.0.0 | ||
export declare class ReadonlyType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyType'; | ||
constructor(name: string, is: ReadonlyType<C, A, O, I>['is'], validate: ReadonlyType<C, A, O, I>['validate'], encode: ReadonlyType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyType' | ||
constructor( | ||
name: string, | ||
is: ReadonlyType<C, A, O, I>['is'], | ||
validate: ReadonlyType<C, A, O, I>['validate'], | ||
encode: ReadonlyType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -875,4 +1031,4 @@ /** | ||
*/ | ||
export interface ReadonlyC<C extends Mixed> extends ReadonlyType<C, Readonly<TypeOf<C>>, Readonly<OutputOf<C>>, unknown> { | ||
} | ||
export interface ReadonlyC<C extends Mixed> | ||
extends ReadonlyType<C, Readonly<TypeOf<C>>, Readonly<OutputOf<C>>, unknown> {} | ||
/** | ||
@@ -882,3 +1038,3 @@ * @category Combinators | ||
*/ | ||
export declare const readonly: <C extends Mixed>(codec: C, name?: string) => ReadonlyC<C>; | ||
export declare const readonly: <C extends Mixed>(codec: C, name?: string) => ReadonlyC<C> | ||
/** | ||
@@ -888,8 +1044,14 @@ * @since 1.0.0 | ||
export declare class ReadonlyArrayType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyArrayType'; | ||
constructor(name: string, is: ReadonlyArrayType<C, A, O, I>['is'], validate: ReadonlyArrayType<C, A, O, I>['validate'], encode: ReadonlyArrayType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyArrayType' | ||
constructor( | ||
name: string, | ||
is: ReadonlyArrayType<C, A, O, I>['is'], | ||
validate: ReadonlyArrayType<C, A, O, I>['validate'], | ||
encode: ReadonlyArrayType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -899,4 +1061,4 @@ /** | ||
*/ | ||
export interface ReadonlyArrayC<C extends Mixed> extends ReadonlyArrayType<C, ReadonlyArray<TypeOf<C>>, ReadonlyArray<OutputOf<C>>, unknown> { | ||
} | ||
export interface ReadonlyArrayC<C extends Mixed> | ||
extends ReadonlyArrayType<C, ReadonlyArray<TypeOf<C>>, ReadonlyArray<OutputOf<C>>, unknown> {} | ||
/** | ||
@@ -906,3 +1068,3 @@ * @category Combinators | ||
*/ | ||
export declare const readonlyArray: <C extends Mixed>(item: C, name?: string) => ReadonlyArrayC<C>; | ||
export declare const readonlyArray: <C extends Mixed>(item: C, name?: string) => ReadonlyArrayC<C> | ||
/** | ||
@@ -914,3 +1076,3 @@ * Strips additional properties | ||
*/ | ||
export declare const strict: <P extends Props>(props: P, name?: string | undefined) => ExactC<TypeC<P>>; | ||
export declare const strict: <P extends Props>(props: P, name?: string | undefined) => ExactC<TypeC<P>> | ||
/** | ||
@@ -921,5 +1083,18 @@ * @category deprecated | ||
*/ | ||
export declare class TaggedUnionType<Tag extends string, CS extends Array<Mixed>, A = any, O = A, I = unknown> extends UnionType<CS, A, O, I> { | ||
readonly tag: Tag; | ||
constructor(name: string, is: TaggedUnionType<Tag, CS, A, O, I>['is'], validate: TaggedUnionType<Tag, CS, A, O, I>['validate'], encode: TaggedUnionType<Tag, CS, A, O, I>['encode'], codecs: CS, tag: Tag); | ||
export declare class TaggedUnionType< | ||
Tag extends string, | ||
CS extends Array<Mixed>, | ||
A = any, | ||
O = A, | ||
I = unknown | ||
> extends UnionType<CS, A, O, I> { | ||
readonly tag: Tag | ||
constructor( | ||
name: string, | ||
is: TaggedUnionType<Tag, CS, A, O, I>['is'], | ||
validate: TaggedUnionType<Tag, CS, A, O, I>['validate'], | ||
encode: TaggedUnionType<Tag, CS, A, O, I>['encode'], | ||
codecs: CS, | ||
tag: Tag | ||
) | ||
} | ||
@@ -931,5 +1106,4 @@ /** | ||
*/ | ||
export interface TaggedUnionC<Tag extends string, CS extends [Mixed, Mixed, ...Array<Mixed>]>// tslint:disable-next-line: deprecation | ||
extends TaggedUnionType<Tag, CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> { | ||
} | ||
export interface TaggedUnionC<Tag extends string, CS extends [Mixed, Mixed, ...Array<Mixed>]> // tslint:disable-next-line: deprecation | ||
extends TaggedUnionType<Tag, CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> {} | ||
/** | ||
@@ -942,3 +1116,7 @@ * Use `union` instead | ||
*/ | ||
export declare const taggedUnion: <Tag extends string, CS extends [Mixed, Mixed, ...Mixed[]]>(tag: Tag, codecs: CS, name?: string) => TaggedUnionC<Tag, CS>; | ||
export declare const taggedUnion: <Tag extends string, CS extends [Mixed, Mixed, ...Mixed[]]>( | ||
tag: Tag, | ||
codecs: CS, | ||
name?: string | ||
) => TaggedUnionC<Tag, CS> | ||
/** | ||
@@ -948,8 +1126,14 @@ * @since 1.1.0 | ||
export declare class ExactType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ExactType'; | ||
constructor(name: string, is: ExactType<C, A, O, I>['is'], validate: ExactType<C, A, O, I>['validate'], encode: ExactType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ExactType' | ||
constructor( | ||
name: string, | ||
is: ExactType<C, A, O, I>['is'], | ||
validate: ExactType<C, A, O, I>['validate'], | ||
encode: ExactType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -959,23 +1143,25 @@ /** | ||
*/ | ||
export interface HasPropsRefinement extends RefinementType<HasProps, any, any, any> { | ||
} | ||
export interface HasPropsRefinement extends RefinementType<HasProps, any, any, any> {} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export interface HasPropsReadonly extends ReadonlyType<HasProps, any, any, any> { | ||
} | ||
export interface HasPropsReadonly extends ReadonlyType<HasProps, any, any, any> {} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export interface HasPropsIntersection extends IntersectionType<Array<HasProps>, any, any, any> { | ||
} | ||
export interface HasPropsIntersection extends IntersectionType<Array<HasProps>, any, any, any> {} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export declare type HasProps = HasPropsRefinement | HasPropsReadonly | HasPropsIntersection | InterfaceType<any, any, any, any> | StrictType<any, any, any, any> | PartialType<any, any, any, any>; | ||
export declare type HasProps = | ||
| HasPropsRefinement | ||
| HasPropsReadonly | ||
| HasPropsIntersection | ||
| InterfaceType<any, any, any, any> | ||
| StrictType<any, any, any, any> | ||
| PartialType<any, any, any, any> | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface ExactC<C extends HasProps> extends ExactType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> { | ||
} | ||
export interface ExactC<C extends HasProps> extends ExactType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> {} | ||
/** | ||
@@ -985,37 +1171,42 @@ * Strips additional properties | ||
*/ | ||
export declare const exact: <C extends HasProps>(codec: C, name?: string) => ExactC<C>; | ||
export { | ||
export declare const exact: <C extends HasProps>(codec: C, name?: string) => ExactC<C> | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
nullType as null | ||
} | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
undefinedType as undefined | ||
} | ||
export { | ||
/** | ||
* Use `UnknownArray` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
UnknownArray as Array | ||
} | ||
export { | ||
/** | ||
* Use `type` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
type as interface | ||
} | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
voidType as void | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
nullType as null }; | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
undefinedType as undefined }; | ||
export { | ||
/** | ||
* Use `UnknownArray` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
UnknownArray as Array }; | ||
export { | ||
/** | ||
* Use `type` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
type as interface }; | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
voidType as void }; | ||
/** | ||
* Use `unknown` instead | ||
@@ -1027,3 +1218,3 @@ * | ||
*/ | ||
export declare type mixed = unknown; | ||
export declare type mixed = unknown | ||
/** | ||
@@ -1034,3 +1225,3 @@ * @category deprecated | ||
*/ | ||
export declare const getValidationError: (value: unknown, context: Context) => ValidationError; | ||
export declare const getValidationError: (value: unknown, context: Context) => ValidationError | ||
/** | ||
@@ -1041,3 +1232,3 @@ * @category deprecated | ||
*/ | ||
export declare const getDefaultContext: (decoder: Decoder<any, any>) => Context; | ||
export declare const getDefaultContext: (decoder: Decoder<any, any>) => Context | ||
/** | ||
@@ -1049,7 +1240,7 @@ * @category deprecated | ||
export declare class NeverType extends Type<never> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NeverType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NeverType' | ||
constructor() | ||
} | ||
@@ -1061,4 +1252,3 @@ /** | ||
*/ | ||
export interface NeverC extends NeverType { | ||
} | ||
export interface NeverC extends NeverType {} | ||
/** | ||
@@ -1069,3 +1259,3 @@ * @category deprecated | ||
*/ | ||
export declare const never: NeverC; | ||
export declare const never: NeverC | ||
/** | ||
@@ -1077,7 +1267,7 @@ * @category deprecated | ||
export declare class AnyType extends Type<any> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyType' | ||
constructor() | ||
} | ||
@@ -1089,4 +1279,3 @@ /** | ||
*/ | ||
export interface AnyC extends AnyType { | ||
} | ||
export interface AnyC extends AnyType {} | ||
/** | ||
@@ -1099,3 +1288,3 @@ * Use `unknown` instead | ||
*/ | ||
export declare const any: AnyC; | ||
export declare const any: AnyC | ||
/** | ||
@@ -1108,3 +1297,3 @@ * Use `UnknownRecord` instead | ||
*/ | ||
export declare const Dictionary: UnknownRecordC; | ||
export declare const Dictionary: UnknownRecordC | ||
/** | ||
@@ -1116,7 +1305,7 @@ * @category deprecated | ||
export declare class ObjectType extends Type<object> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ObjectType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ObjectType' | ||
constructor() | ||
} | ||
@@ -1128,4 +1317,3 @@ /** | ||
*/ | ||
export interface ObjectC extends ObjectType { | ||
} | ||
export interface ObjectC extends ObjectType {} | ||
/** | ||
@@ -1138,3 +1326,3 @@ * Use `UnknownRecord` instead | ||
*/ | ||
export declare const object: ObjectC; | ||
export declare const object: ObjectC | ||
/** | ||
@@ -1147,4 +1335,3 @@ * Use `BrandC` instead | ||
*/ | ||
export interface RefinementC<C extends Any> extends RefinementType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> { | ||
} | ||
export interface RefinementC<C extends Any> extends RefinementType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> {} | ||
/** | ||
@@ -1157,3 +1344,7 @@ * Use `brand` instead | ||
*/ | ||
export declare function refinement<C extends Any>(codec: C, predicate: Predicate<TypeOf<C>>, name?: string): RefinementC<C>; | ||
export declare function refinement<C extends Any>( | ||
codec: C, | ||
predicate: Predicate<TypeOf<C>>, | ||
name?: string | ||
): RefinementC<C> | ||
/** | ||
@@ -1166,3 +1357,3 @@ * Use `Int` instead | ||
*/ | ||
export declare const Integer: RefinementC<NumberC>; | ||
export declare const Integer: RefinementC<NumberC> | ||
/** | ||
@@ -1175,3 +1366,3 @@ * Use `record` instead | ||
*/ | ||
export declare const dictionary: typeof record; | ||
export declare const dictionary: typeof record | ||
/** | ||
@@ -1185,4 +1376,4 @@ * used in `intersection` as a workaround for #234 | ||
export declare type Compact<A> = { | ||
[K in keyof A]: A[K]; | ||
}; | ||
[K in keyof A]: A[K] | ||
} | ||
/** | ||
@@ -1194,8 +1385,14 @@ * @category deprecated | ||
export declare class StrictType<P, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly props: P; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StrictType'; | ||
constructor(name: string, is: StrictType<P, A, O, I>['is'], validate: StrictType<P, A, O, I>['validate'], encode: StrictType<P, A, O, I>['encode'], props: P); | ||
readonly props: P | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StrictType' | ||
constructor( | ||
name: string, | ||
is: StrictType<P, A, O, I>['is'], | ||
validate: StrictType<P, A, O, I>['validate'], | ||
encode: StrictType<P, A, O, I>['encode'], | ||
props: P | ||
) | ||
} | ||
@@ -1207,9 +1404,13 @@ /** | ||
*/ | ||
export interface StrictC<P extends Props>// tslint:disable-next-line: deprecation | ||
extends StrictType<P, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, unknown> { | ||
} | ||
export interface StrictC<P extends Props> // tslint:disable-next-line: deprecation | ||
extends StrictType< | ||
P, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -1221,4 +1422,4 @@ * @category deprecated | ||
export declare type TaggedProps<Tag extends string> = { | ||
[K in Tag]: LiteralType<any>; | ||
}; | ||
[K in Tag]: LiteralType<any> | ||
} | ||
/** | ||
@@ -1229,4 +1430,3 @@ * @category deprecated | ||
*/ | ||
export interface TaggedRefinement<Tag extends string, A, O = A> extends RefinementType<Tagged<Tag>, A, O> { | ||
} | ||
export interface TaggedRefinement<Tag extends string, A, O = A> extends RefinementType<Tagged<Tag>, A, O> {} | ||
/** | ||
@@ -1237,4 +1437,3 @@ * @category deprecated | ||
*/ | ||
export interface TaggedUnion<Tag extends string, A, O = A> extends UnionType<Array<Tagged<Tag>>, A, O> { | ||
} | ||
export interface TaggedUnion<Tag extends string, A, O = A> extends UnionType<Array<Tagged<Tag>>, A, O> {} | ||
/** | ||
@@ -1245,3 +1444,18 @@ * @category deprecated | ||
*/ | ||
export declare type TaggedIntersectionArgument<Tag extends string> = [Tagged<Tag>] | [Tagged<Tag>, Mixed] | [Mixed, Tagged<Tag>] | [Tagged<Tag>, Mixed, Mixed] | [Mixed, Tagged<Tag>, Mixed] | [Mixed, Mixed, Tagged<Tag>] | [Tagged<Tag>, Mixed, Mixed, Mixed] | [Mixed, Tagged<Tag>, Mixed, Mixed] | [Mixed, Mixed, Tagged<Tag>, Mixed] | [Mixed, Mixed, Mixed, Tagged<Tag>] | [Tagged<Tag>, Mixed, Mixed, Mixed, Mixed] | [Mixed, Tagged<Tag>, Mixed, Mixed, Mixed] | [Mixed, Mixed, Tagged<Tag>, Mixed, Mixed] | [Mixed, Mixed, Mixed, Tagged<Tag>, Mixed] | [Mixed, Mixed, Mixed, Mixed, Tagged<Tag>]; | ||
export declare type TaggedIntersectionArgument<Tag extends string> = | ||
| [Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed] | ||
| [Mixed, Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed, Mixed] | ||
| [Mixed, Tagged<Tag>, Mixed] | ||
| [Mixed, Mixed, Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed, Mixed, Mixed] | ||
| [Mixed, Tagged<Tag>, Mixed, Mixed] | ||
| [Mixed, Mixed, Tagged<Tag>, Mixed] | ||
| [Mixed, Mixed, Mixed, Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed, Mixed, Mixed, Mixed] | ||
| [Mixed, Tagged<Tag>, Mixed, Mixed, Mixed] | ||
| [Mixed, Mixed, Tagged<Tag>, Mixed, Mixed] | ||
| [Mixed, Mixed, Mixed, Tagged<Tag>, Mixed] | ||
| [Mixed, Mixed, Mixed, Mixed, Tagged<Tag>] | ||
/** | ||
@@ -1252,5 +1466,4 @@ * @category deprecated | ||
*/ | ||
export interface TaggedIntersection<Tag extends string, A, O = A>// tslint:disable-next-line: deprecation | ||
extends IntersectionType<TaggedIntersectionArgument<Tag>, A, O> { | ||
} | ||
export interface TaggedIntersection<Tag extends string, A, O = A> // tslint:disable-next-line: deprecation | ||
extends IntersectionType<TaggedIntersectionArgument<Tag>, A, O> {} | ||
/** | ||
@@ -1261,4 +1474,3 @@ * @category deprecated | ||
*/ | ||
export interface TaggedExact<Tag extends string, A, O = A> extends ExactType<Tagged<Tag>, A, O> { | ||
} | ||
export interface TaggedExact<Tag extends string, A, O = A> extends ExactType<Tagged<Tag>, A, O> {} | ||
/** | ||
@@ -1269,3 +1481,10 @@ * @category deprecated | ||
*/ | ||
export declare type Tagged<Tag extends string, A = any, O = A> = InterfaceType<TaggedProps<Tag>, A, O> | StrictType<TaggedProps<Tag>, A, O> | TaggedRefinement<Tag, A, O> | TaggedUnion<Tag, A, O> | TaggedIntersection<Tag, A, O> | TaggedExact<Tag, A, O> | RecursiveType<any, A, O>; | ||
export declare type Tagged<Tag extends string, A = any, O = A> = | ||
| InterfaceType<TaggedProps<Tag>, A, O> | ||
| StrictType<TaggedProps<Tag>, A, O> | ||
| TaggedRefinement<Tag, A, O> | ||
| TaggedUnion<Tag, A, O> | ||
| TaggedIntersection<Tag, A, O> | ||
| TaggedExact<Tag, A, O> | ||
| RecursiveType<any, A, O> | ||
/** | ||
@@ -1278,3 +1497,3 @@ * Drops the codec "kind" | ||
*/ | ||
export declare function clean<A, O = A, I = unknown>(codec: Type<A, O, I>): Type<A, O, I>; | ||
export declare function clean<A, O = A, I = unknown>(codec: Type<A, O, I>): Type<A, O, I> | ||
/** | ||
@@ -1285,5 +1504,7 @@ * @category deprecated | ||
*/ | ||
export declare type PropsOf<T extends { | ||
props: any; | ||
}> = T['props']; | ||
export declare type PropsOf< | ||
T extends { | ||
props: any | ||
} | ||
> = T['props'] | ||
/** | ||
@@ -1294,11 +1515,13 @@ * @category deprecated | ||
*/ | ||
export declare type Exact<T, X extends T> = T & { | ||
export declare type Exact<T, X extends T> = T & | ||
{ | ||
[K in ({ | ||
[K in keyof X]: K; | ||
} & { | ||
[K in keyof T]: never; | ||
} & { | ||
[key: string]: never; | ||
})[keyof X]]?: never; | ||
}; | ||
[K in keyof X]: K | ||
} & | ||
{ | ||
[K in keyof T]: never | ||
} & { | ||
[key: string]: never | ||
})[keyof X]]?: never | ||
} | ||
/** | ||
@@ -1311,4 +1534,25 @@ * Keeps the codec "kind" | ||
*/ | ||
export declare function alias<A, O, P, I>(codec: PartialType<P, A, O, I>): <AA extends Exact<A, AA>, OO extends Exact<O, OO> = O, PP extends Exact<P, PP> = P, II extends I = I>() => PartialType<PP, AA, OO, II>; | ||
export declare function alias<A, O, P, I>(codec: StrictType<P, A, O, I>): <AA extends Exact<A, AA>, OO extends Exact<O, OO> = O, PP extends Exact<P, PP> = P, II extends I = I>() => StrictType<PP, AA, OO, II>; | ||
export declare function alias<A, O, P, I>(codec: InterfaceType<P, A, O, I>): <AA extends Exact<A, AA>, OO extends Exact<O, OO> = O, PP extends Exact<P, PP> = P, II extends I = I>() => InterfaceType<PP, AA, OO, II>; | ||
export declare function alias<A, O, P, I>( | ||
codec: PartialType<P, A, O, I> | ||
): < | ||
AA extends Exact<A, AA>, | ||
OO extends Exact<O, OO> = O, | ||
PP extends Exact<P, PP> = P, | ||
II extends I = I | ||
>() => PartialType<PP, AA, OO, II> | ||
export declare function alias<A, O, P, I>( | ||
codec: StrictType<P, A, O, I> | ||
): < | ||
AA extends Exact<A, AA>, | ||
OO extends Exact<O, OO> = O, | ||
PP extends Exact<P, PP> = P, | ||
II extends I = I | ||
>() => StrictType<PP, AA, OO, II> | ||
export declare function alias<A, O, P, I>( | ||
codec: InterfaceType<P, A, O, I> | ||
): < | ||
AA extends Exact<A, AA>, | ||
OO extends Exact<O, OO> = O, | ||
PP extends Exact<P, PP> = P, | ||
II extends I = I | ||
>() => InterfaceType<PP, AA, OO, II> |
@@ -11,12 +11,12 @@ /** | ||
*/ | ||
import { Alt2C } from 'fp-ts/es6/Alt'; | ||
import { Applicative2C } from 'fp-ts/es6/Applicative'; | ||
import { Apply2C } from 'fp-ts/es6/Apply'; | ||
import { Bifunctor2 } from 'fp-ts/es6/Bifunctor'; | ||
import { Functor2C } from 'fp-ts/es6/Functor'; | ||
import { Kind2, URIS2 } from 'fp-ts/es6/HKT'; | ||
import { Monad2C } from 'fp-ts/es6/Monad'; | ||
import { MonadThrow2C } from 'fp-ts/es6/MonadThrow'; | ||
import { Literal } from './Schemable'; | ||
import { Lazy, Refinement } from 'fp-ts/es6/function'; | ||
import { Alt2C } from 'fp-ts/es6/Alt' | ||
import { Applicative2C } from 'fp-ts/es6/Applicative' | ||
import { Apply2C } from 'fp-ts/es6/Apply' | ||
import { Bifunctor2 } from 'fp-ts/es6/Bifunctor' | ||
import { Functor2C } from 'fp-ts/es6/Functor' | ||
import { Kind2, URIS2 } from 'fp-ts/es6/HKT' | ||
import { Monad2C } from 'fp-ts/es6/Monad' | ||
import { MonadThrow2C } from 'fp-ts/es6/MonadThrow' | ||
import { Literal } from './Schemable' | ||
import { Lazy, Refinement } from 'fp-ts/es6/function' | ||
/** | ||
@@ -27,3 +27,3 @@ * @category model | ||
export interface Kleisli<M extends URIS2, I, E, A> { | ||
readonly decode: (i: I) => Kind2<M, E, A>; | ||
readonly decode: (i: I) => Kind2<M, E, A> | ||
} | ||
@@ -34,3 +34,5 @@ /** | ||
*/ | ||
export declare function fromRefinement<M extends URIS2, E>(M: MonadThrow2C<M, E>): <I, A extends I>(refinement: Refinement<I, A>, onError: (i: I) => E) => Kleisli<M, I, E, A>; | ||
export declare function fromRefinement<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> | ||
): <I, A extends I>(refinement: Refinement<I, A>, onError: (i: I) => E) => Kleisli<M, I, E, A> | ||
/** | ||
@@ -40,3 +42,7 @@ * @category constructors | ||
*/ | ||
export declare function literal<M extends URIS2, E>(M: MonadThrow2C<M, E>): <I>(onError: (i: I, values: readonly [Literal, ...Array<Literal>]) => E) => <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kleisli<M, I, E, A[number]>; | ||
export declare function literal<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> | ||
): <I>( | ||
onError: (i: I, values: readonly [Literal, ...Array<Literal>]) => E | ||
) => <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kleisli<M, I, E, A[number]> | ||
/** | ||
@@ -46,3 +52,5 @@ * @category combinators | ||
*/ | ||
export declare function mapLeftWithInput<M extends URIS2>(M: Bifunctor2<M>): <I, E>(f: (i: I, e: E) => E) => <A>(decoder: Kleisli<M, I, E, A>) => Kleisli<M, I, E, A>; | ||
export declare function mapLeftWithInput<M extends URIS2>( | ||
M: Bifunctor2<M> | ||
): <I, E>(f: (i: I, e: E) => E) => <A>(decoder: Kleisli<M, I, E, A>) => Kleisli<M, I, E, A> | ||
/** | ||
@@ -52,3 +60,8 @@ * @category combinators | ||
*/ | ||
export declare function refine<M extends URIS2, E>(M: MonadThrow2C<M, E> & Bifunctor2<M>): <A, B extends A>(refinement: (a: A) => a is B, onError: (a: A) => E) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B>; | ||
export declare function refine<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> & Bifunctor2<M> | ||
): <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
onError: (a: A) => E | ||
) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B> | ||
/** | ||
@@ -58,3 +71,5 @@ * @category combinators | ||
*/ | ||
export declare function parse<M extends URIS2, E>(M: Monad2C<M, E>): <A, B>(decode: (a: A) => Kind2<M, E, B>) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B>; | ||
export declare function parse<M extends URIS2, E>( | ||
M: Monad2C<M, E> | ||
): <A, B>(decode: (a: A) => Kind2<M, E, B>) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B> | ||
/** | ||
@@ -64,3 +79,5 @@ * @category combinators | ||
*/ | ||
export declare function nullable<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): <I>(onError: (i: I, e: E) => E) => <A>(or: Kleisli<M, I, E, A>) => Kleisli<M, null | I, E, null | A>; | ||
export declare function nullable<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): <I>(onError: (i: I, e: E) => E) => <A>(or: Kleisli<M, I, E, A>) => Kleisli<M, null | I, E, null | A> | ||
/** | ||
@@ -70,7 +87,18 @@ * @category combinators | ||
*/ | ||
export declare function fromType<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onPropertyError: (key: string, e: E) => E) => <P extends Record<string, Kleisli<M, any, E, any>>>(properties: P) => Kleisli<M, { | ||
[K in keyof P]: InputOf<M, P[K]>; | ||
}, E, { | ||
[K in keyof P]: TypeOf<M, P[K]>; | ||
}>; | ||
export declare function fromType<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onPropertyError: (key: string, e: E) => E | ||
) => <P extends Record<string, Kleisli<M, any, E, any>>>( | ||
properties: P | ||
) => Kleisli< | ||
M, | ||
{ | ||
[K in keyof P]: InputOf<M, P[K]> | ||
}, | ||
E, | ||
{ | ||
[K in keyof P]: TypeOf<M, P[K]> | ||
} | ||
> | ||
/** | ||
@@ -80,7 +108,22 @@ * @category combinators | ||
*/ | ||
export declare function fromPartial<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onPropertyError: (key: string, e: E) => E) => <P extends Record<string, Kleisli<M, any, E, any>>>(properties: P) => Kleisli<M, Partial<{ | ||
[K in keyof P]: InputOf<M, P[K]>; | ||
}>, E, Partial<{ | ||
[K in keyof P]: TypeOf<M, P[K]>; | ||
}>>; | ||
export declare function fromPartial<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onPropertyError: (key: string, e: E) => E | ||
) => <P extends Record<string, Kleisli<M, any, E, any>>>( | ||
properties: P | ||
) => Kleisli< | ||
M, | ||
Partial< | ||
{ | ||
[K in keyof P]: InputOf<M, P[K]> | ||
} | ||
>, | ||
E, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<M, P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -90,3 +133,5 @@ * @category combinators | ||
*/ | ||
export declare function fromArray<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onItemError: (index: number, e: E) => E) => <I, A>(item: Kleisli<M, I, E, A>) => Kleisli<M, Array<I>, E, Array<A>>; | ||
export declare function fromArray<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): (onItemError: (index: number, e: E) => E) => <I, A>(item: Kleisli<M, I, E, A>) => Kleisli<M, Array<I>, E, Array<A>> | ||
/** | ||
@@ -96,3 +141,7 @@ * @category combinators | ||
*/ | ||
export declare function fromRecord<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onKeyError: (key: string, e: E) => E) => <I, A>(codomain: Kleisli<M, I, E, A>) => Kleisli<M, Record<string, I>, E, Record<string, A>>; | ||
export declare function fromRecord<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onKeyError: (key: string, e: E) => E | ||
) => <I, A>(codomain: Kleisli<M, I, E, A>) => Kleisli<M, Record<string, I>, E, Record<string, A>> | ||
/** | ||
@@ -102,7 +151,18 @@ * @category combinators | ||
*/ | ||
export declare function fromTuple<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onIndexError: (index: number, e: E) => E) => <C extends ReadonlyArray<Kleisli<M, any, E, any>>>(...components: C) => Kleisli<M, { | ||
[K in keyof C]: InputOf<M, C[K]>; | ||
}, E, { | ||
[K in keyof C]: TypeOf<M, C[K]>; | ||
}>; | ||
export declare function fromTuple<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onIndexError: (index: number, e: E) => E | ||
) => <C extends ReadonlyArray<Kleisli<M, any, E, any>>>( | ||
...components: C | ||
) => Kleisli< | ||
M, | ||
{ | ||
[K in keyof C]: InputOf<M, C[K]> | ||
}, | ||
E, | ||
{ | ||
[K in keyof C]: TypeOf<M, C[K]> | ||
} | ||
> | ||
/** | ||
@@ -112,3 +172,9 @@ * @category combinators | ||
*/ | ||
export declare function union<M extends URIS2, E>(M: Alt2C<M, E> & Bifunctor2<M>): (onMemberError: (index: number, e: E) => E) => <MS extends readonly [Kleisli<M, any, E, any>, ...Array<Kleisli<M, any, E, any>>]>(...members: MS) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>>; | ||
export declare function union<M extends URIS2, E>( | ||
M: Alt2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onMemberError: (index: number, e: E) => E | ||
) => <MS extends readonly [Kleisli<M, any, E, any>, ...Array<Kleisli<M, any, E, any>>]>( | ||
...members: MS | ||
) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>> | ||
/** | ||
@@ -118,3 +184,5 @@ * @category combinators | ||
*/ | ||
export declare function intersect<M extends URIS2, E>(M: Apply2C<M, E>): <IB, B>(right: Kleisli<M, IB, E, B>) => <IA, A>(left: Kleisli<M, IA, E, A>) => Kleisli<M, IA & IB, E, A & B>; | ||
export declare function intersect<M extends URIS2, E>( | ||
M: Apply2C<M, E> | ||
): <IB, B>(right: Kleisli<M, IB, E, B>) => <IA, A>(left: Kleisli<M, IA, E, A>) => Kleisli<M, IA & IB, E, A & B> | ||
/** | ||
@@ -124,3 +192,11 @@ * @category combinators | ||
*/ | ||
export declare function fromSum<M extends URIS2, E>(M: MonadThrow2C<M, E>): (onTagError: (tag: string, value: unknown, tags: ReadonlyArray<string>) => E) => <T extends string>(tag: T) => <MS extends Record<string, Kleisli<M, any, E, any>>>(members: MS) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>>; | ||
export declare function fromSum<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> | ||
): ( | ||
onTagError: (tag: string, value: unknown, tags: ReadonlyArray<string>) => E | ||
) => <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, Kleisli<M, any, E, any>>>( | ||
members: MS | ||
) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>> | ||
/** | ||
@@ -130,3 +206,5 @@ * @category combinators | ||
*/ | ||
export declare function lazy<M extends URIS2>(M: Bifunctor2<M>): <E>(onError: (id: string, e: E) => E) => <I, A>(id: string, f: () => Kleisli<M, I, E, A>) => Kleisli<M, I, E, A>; | ||
export declare function lazy<M extends URIS2>( | ||
M: Bifunctor2<M> | ||
): <E>(onError: (id: string, e: E) => E) => <I, A>(id: string, f: () => Kleisli<M, I, E, A>) => Kleisli<M, I, E, A> | ||
/** | ||
@@ -136,3 +214,5 @@ * @category combinators | ||
*/ | ||
export declare function compose<M extends URIS2, E>(M: Monad2C<M, E>): <A, B>(ab: Kleisli<M, A, E, B>) => <I>(ia: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B>; | ||
export declare function compose<M extends URIS2, E>( | ||
M: Monad2C<M, E> | ||
): <A, B>(ab: Kleisli<M, A, E, B>) => <I>(ia: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B> | ||
/** | ||
@@ -142,3 +222,3 @@ * @category combinators | ||
*/ | ||
export declare function id<M extends URIS2, E>(M: Applicative2C<M, E>): <A>() => Kleisli<M, A, E, A>; | ||
export declare function id<M extends URIS2, E>(M: Applicative2C<M, E>): <A>() => Kleisli<M, A, E, A> | ||
/** | ||
@@ -148,3 +228,5 @@ * @category combinators | ||
*/ | ||
export declare function map<F extends URIS2, E>(F: Functor2C<F, E>): <A, B>(f: (a: A) => B) => <I>(ia: Kleisli<F, I, E, A>) => Kleisli<F, I, E, B>; | ||
export declare function map<F extends URIS2, E>( | ||
F: Functor2C<F, E> | ||
): <A, B>(f: (a: A) => B) => <I>(ia: Kleisli<F, I, E, A>) => Kleisli<F, I, E, B> | ||
/** | ||
@@ -154,10 +236,12 @@ * @category combinators | ||
*/ | ||
export declare function alt<F extends URIS2, E>(A: Alt2C<F, E>): <I, A>(that: Lazy<Kleisli<F, I, E, A>>) => (me: Kleisli<F, I, E, A>) => Kleisli<F, I, E, A>; | ||
export declare function alt<F extends URIS2, E>( | ||
A: Alt2C<F, E> | ||
): <I, A>(that: Lazy<Kleisli<F, I, E, A>>) => (me: Kleisli<F, I, E, A>) => Kleisli<F, I, E, A> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type TypeOf<M extends URIS2, KD> = KD extends Kleisli<M, any, any, infer A> ? A : never; | ||
export declare type TypeOf<M extends URIS2, KD> = KD extends Kleisli<M, any, any, infer A> ? A : never | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type InputOf<M extends URIS2, KD> = KD extends Kleisli<M, infer I, any, any> ? I : never; | ||
export declare type InputOf<M extends URIS2, KD> = KD extends Kleisli<M, infer I, any, any> ? I : never |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import { Reporter } from './Reporter'; | ||
import { ValidationError } from '.'; | ||
import { Reporter } from './Reporter' | ||
import { ValidationError } from '.' | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare function failure(es: Array<ValidationError>): Array<string>; | ||
export declare function failure(es: Array<ValidationError>): Array<string> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare function success(): Array<string>; | ||
export declare function success(): Array<string> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const PathReporter: Reporter<Array<string>>; | ||
export declare const PathReporter: Reporter<Array<string>> |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import { Validation } from './index'; | ||
import { Validation } from './index' | ||
/** | ||
@@ -9,3 +9,3 @@ * @since 1.0.0 | ||
export interface Reporter<A> { | ||
report: (validation: Validation<any>) => A; | ||
report: (validation: Validation<any>) => A | ||
} |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT'; | ||
import { Schemable, Schemable1, Schemable2C } from './Schemable'; | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT' | ||
import { Schemable, Schemable1, Schemable2C } from './Schemable' | ||
/** | ||
@@ -19,3 +19,3 @@ * @category model | ||
export interface Schema<A> { | ||
<S>(S: Schemable<S>): HKT<S, A>; | ||
<S>(S: Schemable<S>): HKT<S, A> | ||
} | ||
@@ -26,7 +26,7 @@ /** | ||
*/ | ||
export declare function make<A>(schema: Schema<A>): Schema<A>; | ||
export declare function make<A>(schema: Schema<A>): Schema<A> | ||
/** | ||
* @since 2.2.0 | ||
*/ | ||
export declare type TypeOf<S> = S extends Schema<infer A> ? A : never; | ||
export declare type TypeOf<S> = S extends Schema<infer A> ? A : never | ||
/** | ||
@@ -36,4 +36,4 @@ * @since 2.2.3 | ||
export declare const interpreter: { | ||
<S extends URIS2>(S: Schemable2C<S, unknown>): <A>(schema: Schema<A>) => Kind2<S, unknown, A>; | ||
<S extends URIS>(S: Schemable1<S>): <A>(schema: Schema<A>) => Kind<S, A>; | ||
}; | ||
<S extends URIS2>(S: Schemable2C<S, unknown>): <A>(schema: Schema<A>) => Kind2<S, unknown, A> | ||
<S extends URIS>(S: Schemable1<S>): <A>(schema: Schema<A>) => Kind<S, A> | ||
} |
@@ -11,7 +11,7 @@ /** | ||
*/ | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT'; | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT' | ||
/** | ||
* @since 2.2.0 | ||
*/ | ||
export declare type Literal = string | number | boolean | null; | ||
export declare type Literal = string | number | boolean | null | ||
/** | ||
@@ -21,28 +21,46 @@ * @since 2.2.3 | ||
export interface Schemable<S> { | ||
readonly URI: S; | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => HKT<S, A[number]>; | ||
readonly string: HKT<S, string>; | ||
readonly number: HKT<S, number>; | ||
readonly boolean: HKT<S, boolean>; | ||
readonly nullable: <A>(or: HKT<S, A>) => HKT<S, null | A>; | ||
readonly type: <A>(properties: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, { | ||
[K in keyof A]: A[K]; | ||
}>; | ||
readonly partial: <A>(properties: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
readonly record: <A>(codomain: HKT<S, A>) => HKT<S, Record<string, A>>; | ||
readonly array: <A>(item: HKT<S, A>) => HKT<S, Array<A>>; | ||
readonly tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, A>; | ||
readonly intersect: <B>(right: HKT<S, B>) => <A>(left: HKT<S, A>) => HKT<S, A & B>; | ||
readonly sum: <T extends string>(tag: T) => <A>(members: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, A[keyof A]>; | ||
readonly lazy: <A>(id: string, f: () => HKT<S, A>) => HKT<S, A>; | ||
readonly URI: S | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => HKT<S, A[number]> | ||
readonly string: HKT<S, string> | ||
readonly number: HKT<S, number> | ||
readonly boolean: HKT<S, boolean> | ||
readonly nullable: <A>(or: HKT<S, A>) => HKT<S, null | A> | ||
readonly type: <A>( | ||
properties: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
properties: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT< | ||
S, | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
readonly record: <A>(codomain: HKT<S, A>) => HKT<S, Record<string, A>> | ||
readonly array: <A>(item: HKT<S, A>) => HKT<S, Array<A>> | ||
readonly tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT<S, A> | ||
readonly intersect: <B>(right: HKT<S, B>) => <A>(left: HKT<S, A>) => HKT<S, A & B> | ||
readonly sum: <T extends string>( | ||
tag: T | ||
) => <A>( | ||
members: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT<S, A[keyof A]> | ||
readonly lazy: <A>(id: string, f: () => HKT<S, A>) => HKT<S, A> | ||
} | ||
@@ -53,28 +71,46 @@ /** | ||
export interface Schemable1<S extends URIS> { | ||
readonly URI: S; | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind<S, A[number]>; | ||
readonly string: Kind<S, string>; | ||
readonly number: Kind<S, number>; | ||
readonly boolean: Kind<S, boolean>; | ||
readonly nullable: <A>(or: Kind<S, A>) => Kind<S, null | A>; | ||
readonly type: <A>(properties: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, { | ||
[K in keyof A]: A[K]; | ||
}>; | ||
readonly partial: <A>(properties: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
readonly record: <A>(codomain: Kind<S, A>) => Kind<S, Record<string, A>>; | ||
readonly array: <A>(item: Kind<S, A>) => Kind<S, Array<A>>; | ||
readonly tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, A>; | ||
readonly intersect: <B>(right: Kind<S, B>) => <A>(left: Kind<S, A>) => Kind<S, A & B>; | ||
readonly sum: <T extends string>(tag: T) => <A>(members: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, A[keyof A]>; | ||
readonly lazy: <A>(id: string, f: () => Kind<S, A>) => Kind<S, A>; | ||
readonly URI: S | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind<S, A[number]> | ||
readonly string: Kind<S, string> | ||
readonly number: Kind<S, number> | ||
readonly boolean: Kind<S, boolean> | ||
readonly nullable: <A>(or: Kind<S, A>) => Kind<S, null | A> | ||
readonly type: <A>( | ||
properties: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
properties: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind< | ||
S, | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
readonly record: <A>(codomain: Kind<S, A>) => Kind<S, Record<string, A>> | ||
readonly array: <A>(item: Kind<S, A>) => Kind<S, Array<A>> | ||
readonly tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind<S, A> | ||
readonly intersect: <B>(right: Kind<S, B>) => <A>(left: Kind<S, A>) => Kind<S, A & B> | ||
readonly sum: <T extends string>( | ||
tag: T | ||
) => <A>( | ||
members: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind<S, A[keyof A]> | ||
readonly lazy: <A>(id: string, f: () => Kind<S, A>) => Kind<S, A> | ||
} | ||
@@ -85,28 +121,48 @@ /** | ||
export interface Schemable2C<S extends URIS2, E> { | ||
readonly URI: S; | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind2<S, E, A[number]>; | ||
readonly string: Kind2<S, E, string>; | ||
readonly number: Kind2<S, E, number>; | ||
readonly boolean: Kind2<S, E, boolean>; | ||
readonly nullable: <A>(or: Kind2<S, E, A>) => Kind2<S, E, null | A>; | ||
readonly type: <A>(properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, { | ||
[K in keyof A]: A[K]; | ||
}>; | ||
readonly partial: <A>(properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
readonly record: <A>(codomain: Kind2<S, E, A>) => Kind2<S, E, Record<string, A>>; | ||
readonly array: <A>(item: Kind2<S, E, A>) => Kind2<S, E, Array<A>>; | ||
readonly tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, A>; | ||
readonly intersect: <B>(right: Kind2<S, E, B>) => <A>(left: Kind2<S, E, A>) => Kind2<S, E, A & B>; | ||
readonly sum: <T extends string>(tag: T) => <A>(members: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, A[keyof A]>; | ||
readonly lazy: <A>(id: string, f: () => Kind2<S, E, A>) => Kind2<S, E, A>; | ||
readonly URI: S | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind2<S, E, A[number]> | ||
readonly string: Kind2<S, E, string> | ||
readonly number: Kind2<S, E, number> | ||
readonly boolean: Kind2<S, E, boolean> | ||
readonly nullable: <A>(or: Kind2<S, E, A>) => Kind2<S, E, null | A> | ||
readonly type: <A>( | ||
properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2< | ||
S, | ||
E, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2< | ||
S, | ||
E, | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
readonly record: <A>(codomain: Kind2<S, E, A>) => Kind2<S, E, Record<string, A>> | ||
readonly array: <A>(item: Kind2<S, E, A>) => Kind2<S, E, Array<A>> | ||
readonly tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2<S, E, A> | ||
readonly intersect: <B>(right: Kind2<S, E, B>) => <A>(left: Kind2<S, E, A>) => Kind2<S, E, A & B> | ||
readonly sum: <T extends string>( | ||
tag: T | ||
) => <A>( | ||
members: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2<S, E, A[keyof A]> | ||
readonly lazy: <A>(id: string, f: () => Kind2<S, E, A>) => Kind2<S, E, A> | ||
} | ||
@@ -117,4 +173,4 @@ /** | ||
export interface WithUnknownContainers<S> { | ||
readonly UnknownArray: HKT<S, Array<unknown>>; | ||
readonly UnknownRecord: HKT<S, Record<string, unknown>>; | ||
readonly UnknownArray: HKT<S, Array<unknown>> | ||
readonly UnknownRecord: HKT<S, Record<string, unknown>> | ||
} | ||
@@ -125,4 +181,4 @@ /** | ||
export interface WithUnknownContainers1<S extends URIS> { | ||
readonly UnknownArray: Kind<S, Array<unknown>>; | ||
readonly UnknownRecord: Kind<S, Record<string, unknown>>; | ||
readonly UnknownArray: Kind<S, Array<unknown>> | ||
readonly UnknownRecord: Kind<S, Record<string, unknown>> | ||
} | ||
@@ -133,4 +189,4 @@ /** | ||
export interface WithUnknownContainers2C<S extends URIS2, E> { | ||
readonly UnknownArray: Kind2<S, E, Array<unknown>>; | ||
readonly UnknownRecord: Kind2<S, E, Record<string, unknown>>; | ||
readonly UnknownArray: Kind2<S, E, Array<unknown>> | ||
readonly UnknownRecord: Kind2<S, E, Record<string, unknown>> | ||
} | ||
@@ -141,5 +197,7 @@ /** | ||
export interface WithUnion<S> { | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>(...members: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, A[number]>; | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>( | ||
...members: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT<S, A[number]> | ||
} | ||
@@ -150,5 +208,7 @@ /** | ||
export interface WithUnion1<S extends URIS> { | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>(...members: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, A[number]>; | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>( | ||
...members: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind<S, A[number]> | ||
} | ||
@@ -159,5 +219,7 @@ /** | ||
export interface WithUnion2C<S extends URIS2, E> { | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>(...members: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, A[number]>; | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>( | ||
...members: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2<S, E, A[number]> | ||
} | ||
@@ -168,3 +230,3 @@ /** | ||
export interface WithRefine<S> { | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: HKT<S, A>) => HKT<S, B>; | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: HKT<S, A>) => HKT<S, B> | ||
} | ||
@@ -175,3 +237,3 @@ /** | ||
export interface WithRefine1<S extends URIS> { | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Kind<S, A>) => Kind<S, B>; | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Kind<S, A>) => Kind<S, B> | ||
} | ||
@@ -182,3 +244,6 @@ /** | ||
export interface WithRefine2C<S extends URIS2, E> { | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Kind2<S, E, A>) => Kind2<S, E, B>; | ||
readonly refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => (from: Kind2<S, E, A>) => Kind2<S, E, B> | ||
} | ||
@@ -188,2 +253,2 @@ /** | ||
*/ | ||
export declare function memoize<A, B>(f: (a: A) => B): (a: A) => B; | ||
export declare function memoize<A, B>(f: (a: A) => B): (a: A) => B |
@@ -11,13 +11,13 @@ /** | ||
*/ | ||
import { Alt2 } from 'fp-ts/es6/Alt'; | ||
import { Category2 } from 'fp-ts/es6/Category'; | ||
import { Refinement } from 'fp-ts/es6/function'; | ||
import { Functor2 } from 'fp-ts/es6/Functor'; | ||
import * as TE from 'fp-ts/es6/TaskEither'; | ||
import * as DE from './DecodeError'; | ||
import * as D from './Decoder'; | ||
import * as FS from './FreeSemigroup'; | ||
import * as G from './Guard'; | ||
import * as K from './Kleisli'; | ||
import * as S from './Schemable'; | ||
import { Alt2 } from 'fp-ts/es6/Alt' | ||
import { Category2 } from 'fp-ts/es6/Category' | ||
import { Refinement } from 'fp-ts/es6/function' | ||
import { Functor2 } from 'fp-ts/es6/Functor' | ||
import * as TE from 'fp-ts/es6/TaskEither' | ||
import * as DE from './DecodeError' | ||
import * as D from './Decoder' | ||
import * as FS from './FreeSemigroup' | ||
import * as G from './Guard' | ||
import * as K from './Kleisli' | ||
import * as S from './Schemable' | ||
/** | ||
@@ -27,4 +27,3 @@ * @category model | ||
*/ | ||
export interface TaskDecoder<I, A> extends K.Kleisli<TE.URI, I, DecodeError, A> { | ||
} | ||
export interface TaskDecoder<I, A> extends K.Kleisli<TE.URI, I, DecodeError, A> {} | ||
/** | ||
@@ -34,3 +33,3 @@ * @category DecodeError | ||
*/ | ||
export declare type DecodeError = D.DecodeError; | ||
export declare type DecodeError = D.DecodeError | ||
/** | ||
@@ -40,3 +39,3 @@ * @category DecodeError | ||
*/ | ||
export declare const error: (actual: unknown, message: string) => DecodeError; | ||
export declare const error: (actual: unknown, message: string) => DecodeError | ||
/** | ||
@@ -46,3 +45,3 @@ * @category DecodeError | ||
*/ | ||
export declare const success: <A>(a: A) => TE.TaskEither<DecodeError, A>; | ||
export declare const success: <A>(a: A) => TE.TaskEither<DecodeError, A> | ||
/** | ||
@@ -52,3 +51,6 @@ * @category DecodeError | ||
*/ | ||
export declare const failure: <A = never>(actual: unknown, message: string) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, A>; | ||
export declare const failure: <A = never>( | ||
actual: unknown, | ||
message: string | ||
) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, A> | ||
/** | ||
@@ -58,3 +60,3 @@ * @category constructors | ||
*/ | ||
export declare const fromDecoder: <I, A>(decoder: D.Decoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const fromDecoder: <I, A>(decoder: D.Decoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -64,3 +66,6 @@ * @category constructors | ||
*/ | ||
export declare const fromRefinement: <I, A extends I>(refinement: Refinement<I, A>, expected: string) => TaskDecoder<I, A>; | ||
export declare const fromRefinement: <I, A extends I>( | ||
refinement: Refinement<I, A>, | ||
expected: string | ||
) => TaskDecoder<I, A> | ||
/** | ||
@@ -70,3 +75,3 @@ * @category constructors | ||
*/ | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => TaskDecoder<I, A>; | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => TaskDecoder<I, A> | ||
/** | ||
@@ -76,3 +81,5 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>(...values: A) => TaskDecoder<unknown, A[number]>; | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>( | ||
...values: A | ||
) => TaskDecoder<unknown, A[number]> | ||
/** | ||
@@ -82,3 +89,3 @@ * @category primitives | ||
*/ | ||
export declare const string: TaskDecoder<unknown, string>; | ||
export declare const string: TaskDecoder<unknown, string> | ||
/** | ||
@@ -88,3 +95,3 @@ * @category primitives | ||
*/ | ||
export declare const number: TaskDecoder<unknown, number>; | ||
export declare const number: TaskDecoder<unknown, number> | ||
/** | ||
@@ -94,3 +101,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: TaskDecoder<unknown, boolean>; | ||
export declare const boolean: TaskDecoder<unknown, boolean> | ||
/** | ||
@@ -100,3 +107,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: TaskDecoder<unknown, Array<unknown>>; | ||
export declare const UnknownArray: TaskDecoder<unknown, Array<unknown>> | ||
/** | ||
@@ -106,3 +113,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: TaskDecoder<unknown, Record<string, unknown>>; | ||
export declare const UnknownRecord: TaskDecoder<unknown, Record<string, unknown>> | ||
/** | ||
@@ -112,3 +119,5 @@ * @category combinators | ||
*/ | ||
export declare const mapLeftWithInput: <I>(f: (input: I, e: DecodeError) => DecodeError) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const mapLeftWithInput: <I>( | ||
f: (input: I, e: DecodeError) => DecodeError | ||
) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -118,3 +127,5 @@ * @category combinators | ||
*/ | ||
export declare const withMessage: <I>(message: (input: I, e: DecodeError) => string) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const withMessage: <I>( | ||
message: (input: I, e: DecodeError) => string | ||
) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -124,3 +135,6 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -130,3 +144,5 @@ * @category combinators | ||
*/ | ||
export declare const parse: <A, B>(parser: (a: A) => TE.TaskEither<DecodeError, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const parse: <A, B>( | ||
parser: (a: A) => TE.TaskEither<DecodeError, B> | ||
) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -136,3 +152,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <I, A>(or: TaskDecoder<I, A>) => TaskDecoder<null | I, null | A>; | ||
export declare const nullable: <I, A>(or: TaskDecoder<I, A>) => TaskDecoder<null | I, null | A> | ||
/** | ||
@@ -142,3 +158,8 @@ * @category combinators | ||
*/ | ||
export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>(properties: P) => TaskDecoder<{ [K in keyof P]: K.InputOf<"TaskEither", P[K]>; }, { [K_1 in keyof P]: K.TypeOf<"TaskEither", P[K_1]>; }>; | ||
export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>( | ||
properties: P | ||
) => TaskDecoder< | ||
{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, | ||
{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } | ||
> | ||
/** | ||
@@ -148,3 +169,5 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, { [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>( | ||
properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -154,3 +177,8 @@ * @category combinators | ||
*/ | ||
export declare const fromPartial: <P extends Record<string, TaskDecoder<any, any>>>(properties: P) => TaskDecoder<Partial<{ [K in keyof P]: K.InputOf<"TaskEither", P[K]>; }>, Partial<{ [K_1 in keyof P]: K.TypeOf<"TaskEither", P[K_1]>; }>>; | ||
export declare const fromPartial: <P extends Record<string, TaskDecoder<any, any>>>( | ||
properties: P | ||
) => TaskDecoder< | ||
Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, | ||
Partial<{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> }> | ||
> | ||
/** | ||
@@ -160,3 +188,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -166,3 +196,3 @@ * @category combinators | ||
*/ | ||
export declare const fromArray: <I, A>(item: TaskDecoder<I, A>) => TaskDecoder<I[], A[]>; | ||
export declare const fromArray: <I, A>(item: TaskDecoder<I, A>) => TaskDecoder<I[], A[]> | ||
/** | ||
@@ -172,3 +202,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: TaskDecoder<unknown, A>) => TaskDecoder<unknown, A[]>; | ||
export declare const array: <A>(item: TaskDecoder<unknown, A>) => TaskDecoder<unknown, A[]> | ||
/** | ||
@@ -178,3 +208,5 @@ * @category combinators | ||
*/ | ||
export declare const fromRecord: <I, A>(codomain: TaskDecoder<I, A>) => TaskDecoder<Record<string, I>, Record<string, A>>; | ||
export declare const fromRecord: <I, A>( | ||
codomain: TaskDecoder<I, A> | ||
) => TaskDecoder<Record<string, I>, Record<string, A>> | ||
/** | ||
@@ -184,3 +216,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: TaskDecoder<unknown, A>) => TaskDecoder<unknown, Record<string, A>>; | ||
export declare const record: <A>(codomain: TaskDecoder<unknown, A>) => TaskDecoder<unknown, Record<string, A>> | ||
/** | ||
@@ -190,3 +222,8 @@ * @category combinators | ||
*/ | ||
export declare const fromTuple: <C extends readonly TaskDecoder<any, any>[]>(...components: C) => TaskDecoder<{ [K in keyof C]: K.InputOf<"TaskEither", C[K]>; }, { [K_1 in keyof C]: K.TypeOf<"TaskEither", C[K_1]>; }>; | ||
export declare const fromTuple: <C extends readonly TaskDecoder<any, any>[]>( | ||
...components: C | ||
) => TaskDecoder< | ||
{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, | ||
{ [K_1 in keyof C]: K.TypeOf<'TaskEither', C[K_1]> } | ||
> | ||
/** | ||
@@ -196,3 +233,5 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, A>; | ||
export declare const tuple: <A extends readonly unknown[]>( | ||
...components: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, A> | ||
/** | ||
@@ -202,3 +241,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <MS extends readonly [TaskDecoder<any, any>, ...Array<TaskDecoder<any, any>>]>(...members: MS) => TaskDecoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>>; | ||
export declare const union: <MS extends readonly [TaskDecoder<any, any>, ...Array<TaskDecoder<any, any>>]>( | ||
...members: MS | ||
) => TaskDecoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -208,3 +249,5 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <IB, B>(right: TaskDecoder<IB, B>) => <IA, A>(left: TaskDecoder<IA, A>) => TaskDecoder<IA & IB, A & B>; | ||
export declare const intersect: <IB, B>( | ||
right: TaskDecoder<IB, B> | ||
) => <IA, A>(left: TaskDecoder<IA, A>) => TaskDecoder<IA & IB, A & B> | ||
/** | ||
@@ -214,3 +257,7 @@ * @category combinators | ||
*/ | ||
export declare const fromSum: <T extends string>(tag: T) => <MS extends Record<string, TaskDecoder<any, any>>>(members: MS) => TaskDecoder<K.InputOf<"TaskEither", MS[keyof MS]>, K.TypeOf<"TaskEither", MS[keyof MS]>>; | ||
export declare const fromSum: <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, TaskDecoder<any, any>>>( | ||
members: MS | ||
) => TaskDecoder<K.InputOf<'TaskEither', MS[keyof MS]>, K.TypeOf<'TaskEither', MS[keyof MS]>> | ||
/** | ||
@@ -220,3 +267,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(tag: T) => <A>(members: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
tag: T | ||
) => <A>(members: { [K in keyof A]: TaskDecoder<unknown, A[K]> }) => TaskDecoder<unknown, A[keyof A]> | ||
/** | ||
@@ -226,3 +275,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <I, A>(id: string, f: () => TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const lazy: <I, A>(id: string, f: () => TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -232,3 +281,3 @@ * @category Functor | ||
*/ | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -238,3 +287,3 @@ * @category Alt | ||
*/ | ||
export declare const alt: <I, A>(that: () => TaskDecoder<I, A>) => (me: TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const alt: <I, A>(that: () => TaskDecoder<I, A>) => (me: TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -244,3 +293,3 @@ * @category Semigroupoid | ||
*/ | ||
export declare const compose: <A, B>(to: TaskDecoder<A, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const compose: <A, B>(to: TaskDecoder<A, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -250,3 +299,3 @@ * @category Category | ||
*/ | ||
export declare const id: <A>() => TaskDecoder<A, A>; | ||
export declare const id: <A>() => TaskDecoder<A, A> | ||
/** | ||
@@ -256,3 +305,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/TaskDecoder"; | ||
export declare const URI = 'io-ts/TaskDecoder' | ||
/** | ||
@@ -262,7 +311,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: TaskDecoder<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: TaskDecoder<E, A> | ||
} | ||
} | ||
@@ -273,3 +322,3 @@ /** | ||
*/ | ||
export declare const Functor: Functor2<URI>; | ||
export declare const Functor: Functor2<URI> | ||
/** | ||
@@ -279,3 +328,3 @@ * @category instances | ||
*/ | ||
export declare const Alt: Alt2<URI>; | ||
export declare const Alt: Alt2<URI> | ||
/** | ||
@@ -285,3 +334,3 @@ * @category instances | ||
*/ | ||
export declare const Category: Category2<URI>; | ||
export declare const Category: Category2<URI> | ||
/** | ||
@@ -291,3 +340,3 @@ * @category instances | ||
*/ | ||
export declare const Schemable: S.Schemable2C<URI, unknown>; | ||
export declare const Schemable: S.Schemable2C<URI, unknown> | ||
/** | ||
@@ -297,3 +346,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown>; | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown> | ||
/** | ||
@@ -303,3 +352,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown>; | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown> | ||
/** | ||
@@ -309,14 +358,14 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown>; | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type TypeOf<KTD> = K.TypeOf<TE.URI, KTD>; | ||
export declare type TypeOf<KTD> = K.TypeOf<TE.URI, KTD> | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<KTD> = K.InputOf<TE.URI, KTD>; | ||
export declare type InputOf<KTD> = K.InputOf<TE.URI, KTD> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare const draw: (e: DecodeError) => string; | ||
export declare const draw: (e: DecodeError) => string |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import { Reporter } from './Reporter'; | ||
import { Reporter } from './Reporter' | ||
/** | ||
@@ -12,2 +12,2 @@ * @category deprecated | ||
*/ | ||
export declare const ThrowReporter: Reporter<void>; | ||
export declare const ThrowReporter: Reporter<void> |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import * as t from './index'; | ||
import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable'; | ||
import * as t from './index' | ||
import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' | ||
/** | ||
@@ -18,4 +18,3 @@ * @category model | ||
*/ | ||
export interface Type<A> extends t.Type<A, unknown, unknown> { | ||
} | ||
export interface Type<A> extends t.Type<A, unknown, unknown> {} | ||
/** | ||
@@ -25,3 +24,3 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Type<A[number]>; | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Type<A[number]> | ||
/** | ||
@@ -31,3 +30,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Type<string>; | ||
export declare const string: Type<string> | ||
/** | ||
@@ -37,3 +36,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Type<number>; | ||
export declare const number: Type<number> | ||
/** | ||
@@ -43,3 +42,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Type<boolean>; | ||
export declare const boolean: Type<boolean> | ||
/** | ||
@@ -49,3 +48,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Type<Array<unknown>>; | ||
export declare const UnknownArray: Type<Array<unknown>> | ||
/** | ||
@@ -55,3 +54,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Type<Record<string, unknown>>; | ||
export declare const UnknownRecord: Type<Record<string, unknown>> | ||
/** | ||
@@ -61,3 +60,3 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Type<A>) => Type<B>; | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Type<A>) => Type<B> | ||
/** | ||
@@ -67,3 +66,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <A>(or: Type<A>) => Type<A | null>; | ||
export declare const nullable: <A>(or: Type<A>) => Type<A | null> | ||
/** | ||
@@ -73,3 +72,3 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]>; }) => Type<{ [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -79,3 +78,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: Type<A[K]>; }) => Type<Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: Type<A[K]> } | ||
) => Type<Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -85,3 +86,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Type<A>) => Type<Record<string, A>>; | ||
export declare const record: <A>(codomain: Type<A>) => Type<Record<string, A>> | ||
/** | ||
@@ -91,3 +92,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: Type<A>) => Type<A[]>; | ||
export declare const array: <A>(item: Type<A>) => Type<A[]> | ||
/** | ||
@@ -97,3 +98,3 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Type<A[K]>; }) => Type<A>; | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Type<A[K]> }) => Type<A> | ||
/** | ||
@@ -103,3 +104,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <B>(right: Type<B>) => <A>(left: Type<A>) => Type<A & B>; | ||
export declare const intersect: <B>(right: Type<B>) => <A>(left: Type<A>) => Type<A & B> | ||
/** | ||
@@ -109,3 +110,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <A>(id: string, f: () => Type<A>) => Type<A>; | ||
export declare const lazy: <A>(id: string, f: () => Type<A>) => Type<A> | ||
/** | ||
@@ -115,3 +116,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(_tag: T) => <A>(members: { [K in keyof A]: Type<A[K]>; }) => Type<A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
_tag: T | ||
) => <A>(members: { [K in keyof A]: Type<A[K]> }) => Type<A[keyof A]> | ||
/** | ||
@@ -121,3 +124,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>(...members: { [K in keyof A]: Type<A[K]>; }) => Type<A[number]>; | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>( | ||
...members: { [K in keyof A]: Type<A[K]> } | ||
) => Type<A[number]> | ||
/** | ||
@@ -127,3 +132,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Type"; | ||
export declare const URI = 'io-ts/Type' | ||
/** | ||
@@ -133,7 +138,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind<A> { | ||
readonly [URI]: Type<A>; | ||
} | ||
interface URItoKind<A> { | ||
readonly [URI]: Type<A> | ||
} | ||
} | ||
@@ -144,3 +149,3 @@ /** | ||
*/ | ||
export declare const Schemable: Schemable1<URI>; | ||
export declare const Schemable: Schemable1<URI> | ||
/** | ||
@@ -150,3 +155,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI>; | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI> | ||
/** | ||
@@ -156,3 +161,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: WithUnion1<URI>; | ||
export declare const WithUnion: WithUnion1<URI> | ||
/** | ||
@@ -162,2 +167,2 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: WithRefine1<URI>; | ||
export declare const WithRefine: WithRefine1<URI> |
@@ -1,5 +0,5 @@ | ||
import { Invariant3 } from 'fp-ts/lib/Invariant'; | ||
import * as D from './Decoder'; | ||
import * as E from './Encoder'; | ||
import { Literal } from './Schemable'; | ||
import { Invariant3 } from 'fp-ts/lib/Invariant' | ||
import * as D from './Decoder' | ||
import * as E from './Encoder' | ||
import { Literal } from './Schemable' | ||
/** | ||
@@ -14,4 +14,3 @@ * Laws: | ||
*/ | ||
export interface Codec<I, O, A> extends D.Decoder<I, A>, E.Encoder<O, A> { | ||
} | ||
export interface Codec<I, O, A> extends D.Decoder<I, A>, E.Encoder<O, A> {} | ||
/** | ||
@@ -21,3 +20,3 @@ * @category constructors | ||
*/ | ||
export declare function make<I, O, A>(decoder: D.Decoder<I, A>, encoder: E.Encoder<O, A>): Codec<I, O, A>; | ||
export declare function make<I, O, A>(decoder: D.Decoder<I, A>, encoder: E.Encoder<O, A>): Codec<I, O, A> | ||
/** | ||
@@ -27,3 +26,3 @@ * @category constructors | ||
*/ | ||
export declare function fromDecoder<I, A>(decoder: D.Decoder<I, A>): Codec<I, A, A>; | ||
export declare function fromDecoder<I, A>(decoder: D.Decoder<I, A>): Codec<I, A, A> | ||
/** | ||
@@ -33,3 +32,5 @@ * @category constructors | ||
*/ | ||
export declare function literal<A extends readonly [Literal, ...Array<Literal>]>(...values: A): Codec<unknown, A[number], A[number]>; | ||
export declare function literal<A extends readonly [Literal, ...Array<Literal>]>( | ||
...values: A | ||
): Codec<unknown, A[number], A[number]> | ||
/** | ||
@@ -39,3 +40,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Codec<unknown, string, string>; | ||
export declare const string: Codec<unknown, string, string> | ||
/** | ||
@@ -45,3 +46,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Codec<unknown, number, number>; | ||
export declare const number: Codec<unknown, number, number> | ||
/** | ||
@@ -51,3 +52,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Codec<unknown, boolean, boolean>; | ||
export declare const boolean: Codec<unknown, boolean, boolean> | ||
/** | ||
@@ -57,3 +58,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Codec<unknown, Array<unknown>, Array<unknown>>; | ||
export declare const UnknownArray: Codec<unknown, Array<unknown>, Array<unknown>> | ||
/** | ||
@@ -63,3 +64,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Codec<unknown, Record<string, unknown>, Record<string, unknown>>; | ||
export declare const UnknownRecord: Codec<unknown, Record<string, unknown>, Record<string, unknown>> | ||
/** | ||
@@ -69,3 +70,5 @@ * @category combinators | ||
*/ | ||
export declare const mapLeftWithInput: <I>(f: (i: I, e: D.DecodeError) => D.DecodeError) => <O, A>(codec: Codec<I, O, A>) => Codec<I, O, A>; | ||
export declare const mapLeftWithInput: <I>( | ||
f: (i: I, e: D.DecodeError) => D.DecodeError | ||
) => <O, A>(codec: Codec<I, O, A>) => Codec<I, O, A> | ||
/** | ||
@@ -75,3 +78,6 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B>; | ||
export declare const refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B> | ||
/** | ||
@@ -81,3 +87,3 @@ * @category combinators | ||
*/ | ||
export declare function nullable<I, O, A>(or: Codec<I, O, A>): Codec<null | I, null | O, null | A>; | ||
export declare function nullable<I, O, A>(or: Codec<I, O, A>): Codec<null | I, null | O, null | A> | ||
/** | ||
@@ -87,9 +93,15 @@ * @category combinators | ||
*/ | ||
export declare function fromType<P extends Record<string, Codec<any, any, any>>>(properties: P): Codec<{ | ||
[K in keyof P]: InputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>; | ||
export declare function fromType<P extends Record<string, Codec<any, any, any>>>( | ||
properties: P | ||
): Codec< | ||
{ | ||
[K in keyof P]: InputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
/** | ||
@@ -99,7 +111,13 @@ * @category combinators | ||
*/ | ||
export declare function type<P extends Record<string, Codec<unknown, any, any>>>(properties: P): Codec<unknown, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>; | ||
export declare function type<P extends Record<string, Codec<unknown, any, any>>>( | ||
properties: P | ||
): Codec< | ||
unknown, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
/** | ||
@@ -109,9 +127,21 @@ * @category combinators | ||
*/ | ||
export declare function fromPartial<P extends Record<string, Codec<any, any, any>>>(properties: P): Codec<Partial<{ | ||
[K in keyof P]: InputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>>; | ||
export declare function fromPartial<P extends Record<string, Codec<any, any, any>>>( | ||
properties: P | ||
): Codec< | ||
Partial< | ||
{ | ||
[K in keyof P]: InputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -121,7 +151,17 @@ * @category combinators | ||
*/ | ||
export declare function partial<P extends Record<string, Codec<unknown, any, any>>>(properties: P): Codec<unknown, Partial<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>>; | ||
export declare function partial<P extends Record<string, Codec<unknown, any, any>>>( | ||
properties: P | ||
): Codec< | ||
unknown, | ||
Partial< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -131,3 +171,3 @@ * @category combinators | ||
*/ | ||
export declare function fromArray<I, O, A>(item: Codec<I, O, A>): Codec<Array<I>, Array<O>, Array<A>>; | ||
export declare function fromArray<I, O, A>(item: Codec<I, O, A>): Codec<Array<I>, Array<O>, Array<A>> | ||
/** | ||
@@ -137,3 +177,3 @@ * @category combinators | ||
*/ | ||
export declare function array<O, A>(item: Codec<unknown, O, A>): Codec<unknown, Array<O>, Array<A>>; | ||
export declare function array<O, A>(item: Codec<unknown, O, A>): Codec<unknown, Array<O>, Array<A>> | ||
/** | ||
@@ -143,3 +183,5 @@ * @category combinators | ||
*/ | ||
export declare function fromRecord<I, O, A>(codomain: Codec<I, O, A>): Codec<Record<string, I>, Record<string, O>, Record<string, A>>; | ||
export declare function fromRecord<I, O, A>( | ||
codomain: Codec<I, O, A> | ||
): Codec<Record<string, I>, Record<string, O>, Record<string, A>> | ||
/** | ||
@@ -149,3 +191,5 @@ * @category combinators | ||
*/ | ||
export declare function record<O, A>(codomain: Codec<unknown, O, A>): Codec<unknown, Record<string, O>, Record<string, A>>; | ||
export declare function record<O, A>( | ||
codomain: Codec<unknown, O, A> | ||
): Codec<unknown, Record<string, O>, Record<string, A>> | ||
/** | ||
@@ -155,3 +199,9 @@ * @category combinators | ||
*/ | ||
export declare const fromTuple: <C extends readonly Codec<any, any, any>[]>(...components: C) => Codec<{ [K in keyof C]: import("./Kleisli").InputOf<"Either", C[K]>; }, { [K_1 in keyof C]: E.OutputOf<C[K_1]>; }, { [K_2 in keyof C]: E.TypeOf<C[K_2]>; }>; | ||
export declare const fromTuple: <C extends readonly Codec<any, any, any>[]>( | ||
...components: C | ||
) => Codec< | ||
{ [K in keyof C]: import('./Kleisli').InputOf<'Either', C[K]> }, | ||
{ [K_1 in keyof C]: E.OutputOf<C[K_1]> }, | ||
{ [K_2 in keyof C]: E.TypeOf<C[K_2]> } | ||
> | ||
/** | ||
@@ -161,7 +211,13 @@ * @category combinators | ||
*/ | ||
export declare function tuple<C extends ReadonlyArray<Codec<unknown, any, any>>>(...components: C): Codec<unknown, { | ||
[K in keyof C]: OutputOf<C[K]>; | ||
}, { | ||
[K in keyof C]: TypeOf<C[K]>; | ||
}>; | ||
export declare function tuple<C extends ReadonlyArray<Codec<unknown, any, any>>>( | ||
...components: C | ||
): Codec< | ||
unknown, | ||
{ | ||
[K in keyof C]: OutputOf<C[K]> | ||
}, | ||
{ | ||
[K in keyof C]: TypeOf<C[K]> | ||
} | ||
> | ||
/** | ||
@@ -171,3 +227,5 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <IB, OB, B>(right: Codec<IB, OB, B>) => <IA, OA, A>(left: Codec<IA, OA, A>) => Codec<IA & IB, OA & OB, A & B>; | ||
export declare const intersect: <IB, OB, B>( | ||
right: Codec<IB, OB, B> | ||
) => <IA, OA, A>(left: Codec<IA, OA, A>) => Codec<IA & IB, OA & OB, A & B> | ||
/** | ||
@@ -177,3 +235,7 @@ * @category combinators | ||
*/ | ||
export declare const fromSum: <T extends string>(tag: T) => <MS extends Record<string, Codec<any, any, any>>>(members: MS) => Codec<import("./Kleisli").InputOf<"Either", MS[keyof MS]>, E.OutputOf<MS[keyof MS]>, E.TypeOf<MS[keyof MS]>>; | ||
export declare const fromSum: <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, Codec<any, any, any>>>( | ||
members: MS | ||
) => Codec<import('./Kleisli').InputOf<'Either', MS[keyof MS]>, E.OutputOf<MS[keyof MS]>, E.TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -183,3 +245,7 @@ * @category combinators | ||
*/ | ||
export declare function sum<T extends string>(tag: T): <M extends Record<string, Codec<unknown, any, any>>>(members: M) => Codec<unknown, OutputOf<M[keyof M]>, TypeOf<M[keyof M]>>; | ||
export declare function sum<T extends string>( | ||
tag: T | ||
): <M extends Record<string, Codec<unknown, any, any>>>( | ||
members: M | ||
) => Codec<unknown, OutputOf<M[keyof M]>, TypeOf<M[keyof M]>> | ||
/** | ||
@@ -189,3 +255,3 @@ * @category combinators | ||
*/ | ||
export declare function lazy<I, O, A>(id: string, f: () => Codec<I, O, A>): Codec<I, O, A>; | ||
export declare function lazy<I, O, A>(id: string, f: () => Codec<I, O, A>): Codec<I, O, A> | ||
/** | ||
@@ -195,3 +261,5 @@ * @category combinators | ||
*/ | ||
export declare const compose: <L, A extends L, P extends A, B>(to: Codec<L, P, B>) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B>; | ||
export declare const compose: <L, A extends L, P extends A, B>( | ||
to: Codec<L, P, B> | ||
) => <I, O>(from: Codec<I, O, A>) => Codec<I, O, B> | ||
/** | ||
@@ -201,3 +269,3 @@ * @category Invariant | ||
*/ | ||
export declare const imap: <I, O, A, B>(f: (a: A) => B, g: (b: B) => A) => (fa: Codec<I, O, A>) => Codec<I, O, B>; | ||
export declare const imap: <I, O, A, B>(f: (a: A) => B, g: (b: B) => A) => (fa: Codec<I, O, A>) => Codec<I, O, B> | ||
/** | ||
@@ -207,3 +275,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Codec"; | ||
export declare const URI = 'io-ts/Codec' | ||
/** | ||
@@ -213,7 +281,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind3<R, E, A> { | ||
readonly [URI]: Codec<R, E, A>; | ||
} | ||
interface URItoKind3<R, E, A> { | ||
readonly [URI]: Codec<R, E, A> | ||
} | ||
} | ||
@@ -224,14 +292,14 @@ /** | ||
*/ | ||
export declare const Invariant: Invariant3<URI>; | ||
export declare const Invariant: Invariant3<URI> | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<C> = D.InputOf<C>; | ||
export declare type InputOf<C> = D.InputOf<C> | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type OutputOf<C> = E.OutputOf<C>; | ||
export declare type OutputOf<C> = E.OutputOf<C> | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type TypeOf<C> = E.TypeOf<C>; | ||
export declare type TypeOf<C> = E.TypeOf<C> |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -16,4 +35,4 @@ exports.Invariant = exports.URI = exports.imap = exports.compose = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.fromType = exports.nullable = exports.refine = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromDecoder = exports.make = void 0; | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var D = require("./Decoder"); | ||
var E = require("./Encoder"); | ||
var D = __importStar(require("./Decoder")); | ||
var E = __importStar(require("./Encoder")); | ||
// ------------------------------------------------------------------------------------- | ||
@@ -20,0 +39,0 @@ // constructors |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import { Semigroup } from 'fp-ts/lib/Semigroup'; | ||
import * as FS from './FreeSemigroup'; | ||
import { Semigroup } from 'fp-ts/lib/Semigroup' | ||
import * as FS from './FreeSemigroup' | ||
/** | ||
@@ -19,5 +19,5 @@ * @category model | ||
export interface Leaf<E> { | ||
readonly _tag: 'Leaf'; | ||
readonly actual: unknown; | ||
readonly error: E; | ||
readonly _tag: 'Leaf' | ||
readonly actual: unknown | ||
readonly error: E | ||
} | ||
@@ -28,3 +28,3 @@ /** | ||
*/ | ||
export declare const required: 'required'; | ||
export declare const required: 'required' | ||
/** | ||
@@ -34,3 +34,3 @@ * @category model | ||
*/ | ||
export declare const optional: 'optional'; | ||
export declare const optional: 'optional' | ||
/** | ||
@@ -40,3 +40,3 @@ * @category model | ||
*/ | ||
export declare type Kind = 'required' | 'optional'; | ||
export declare type Kind = 'required' | 'optional' | ||
/** | ||
@@ -47,6 +47,6 @@ * @category model | ||
export interface Key<E> { | ||
readonly _tag: 'Key'; | ||
readonly key: string; | ||
readonly kind: Kind; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Key' | ||
readonly key: string | ||
readonly kind: Kind | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -58,6 +58,6 @@ /** | ||
export interface Index<E> { | ||
readonly _tag: 'Index'; | ||
readonly index: number; | ||
readonly kind: Kind; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Index' | ||
readonly index: number | ||
readonly kind: Kind | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -69,5 +69,5 @@ /** | ||
export interface Member<E> { | ||
readonly _tag: 'Member'; | ||
readonly index: number; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Member' | ||
readonly index: number | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -79,5 +79,5 @@ /** | ||
export interface Lazy<E> { | ||
readonly _tag: 'Lazy'; | ||
readonly id: string; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Lazy' | ||
readonly id: string | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -89,5 +89,5 @@ /** | ||
export interface Wrap<E> { | ||
readonly _tag: 'Wrap'; | ||
readonly error: E; | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>>; | ||
readonly _tag: 'Wrap' | ||
readonly error: E | ||
readonly errors: FS.FreeSemigroup<DecodeError<E>> | ||
} | ||
@@ -98,3 +98,3 @@ /** | ||
*/ | ||
export declare type DecodeError<E> = Leaf<E> | Key<E> | Index<E> | Member<E> | Lazy<E> | Wrap<E>; | ||
export declare type DecodeError<E> = Leaf<E> | Key<E> | Index<E> | Member<E> | Lazy<E> | Wrap<E> | ||
/** | ||
@@ -104,3 +104,3 @@ * @category constructors | ||
*/ | ||
export declare const leaf: <E>(actual: unknown, error: E) => DecodeError<E>; | ||
export declare const leaf: <E>(actual: unknown, error: E) => DecodeError<E> | ||
/** | ||
@@ -110,3 +110,3 @@ * @category constructors | ||
*/ | ||
export declare const key: <E>(key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const key: <E>(key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -116,3 +116,3 @@ * @category constructors | ||
*/ | ||
export declare const index: <E>(index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const index: <E>(index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -122,3 +122,3 @@ * @category constructors | ||
*/ | ||
export declare const member: <E>(index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const member: <E>(index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -128,3 +128,3 @@ * @category constructors | ||
*/ | ||
export declare const lazy: <E>(id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const lazy: <E>(id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -134,3 +134,3 @@ * @category constructors | ||
*/ | ||
export declare const wrap: <E>(error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E>; | ||
export declare const wrap: <E>(error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => DecodeError<E> | ||
/** | ||
@@ -141,9 +141,9 @@ * @category destructors | ||
export declare const fold: <E, R>(patterns: { | ||
Leaf: (input: unknown, error: E) => R; | ||
Key: (key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Index: (index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Member: (index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Lazy: (id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
Wrap: (error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => R; | ||
}) => (e: DecodeError<E>) => R; | ||
Leaf: (input: unknown, error: E) => R | ||
Key: (key: string, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Index: (index: number, kind: Kind, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Member: (index: number, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Lazy: (id: string, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
Wrap: (error: E, errors: FS.FreeSemigroup<DecodeError<E>>) => R | ||
}) => (e: DecodeError<E>) => R | ||
/** | ||
@@ -153,2 +153,2 @@ * @category instances | ||
*/ | ||
export declare function getSemigroup<E = never>(): Semigroup<FS.FreeSemigroup<DecodeError<E>>>; | ||
export declare function getSemigroup<E = never>(): Semigroup<FS.FreeSemigroup<DecodeError<E>>> |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSemigroup = exports.fold = exports.wrap = exports.lazy = exports.member = exports.index = exports.key = exports.leaf = exports.optional = exports.required = void 0; | ||
var FS = require("./FreeSemigroup"); | ||
var FS = __importStar(require("./FreeSemigroup")); | ||
/** | ||
@@ -6,0 +25,0 @@ * @category model |
@@ -11,12 +11,12 @@ /** | ||
*/ | ||
import { Alt2 } from 'fp-ts/lib/Alt'; | ||
import { Category2 } from 'fp-ts/lib/Category'; | ||
import * as E from 'fp-ts/lib/Either'; | ||
import { Refinement } from 'fp-ts/lib/function'; | ||
import { Functor2 } from 'fp-ts/lib/Functor'; | ||
import * as DE from './DecodeError'; | ||
import * as FS from './FreeSemigroup'; | ||
import * as G from './Guard'; | ||
import * as K from './Kleisli'; | ||
import * as S from './Schemable'; | ||
import { Alt2 } from 'fp-ts/lib/Alt' | ||
import { Category2 } from 'fp-ts/lib/Category' | ||
import * as E from 'fp-ts/lib/Either' | ||
import { Refinement } from 'fp-ts/lib/function' | ||
import { Functor2 } from 'fp-ts/lib/Functor' | ||
import * as DE from './DecodeError' | ||
import * as FS from './FreeSemigroup' | ||
import * as G from './Guard' | ||
import * as K from './Kleisli' | ||
import * as S from './Schemable' | ||
/** | ||
@@ -26,4 +26,3 @@ * @category model | ||
*/ | ||
export interface Decoder<I, A> extends K.Kleisli<E.URI, I, DecodeError, A> { | ||
} | ||
export interface Decoder<I, A> extends K.Kleisli<E.URI, I, DecodeError, A> {} | ||
/** | ||
@@ -33,3 +32,3 @@ * @category DecodeError | ||
*/ | ||
export declare type DecodeError = FS.FreeSemigroup<DE.DecodeError<string>>; | ||
export declare type DecodeError = FS.FreeSemigroup<DE.DecodeError<string>> | ||
/** | ||
@@ -39,3 +38,3 @@ * @category DecodeError | ||
*/ | ||
export declare const error: (actual: unknown, message: string) => DecodeError; | ||
export declare const error: (actual: unknown, message: string) => DecodeError | ||
/** | ||
@@ -45,3 +44,3 @@ * @category DecodeError | ||
*/ | ||
export declare const success: <A>(a: A) => E.Either<DecodeError, A>; | ||
export declare const success: <A>(a: A) => E.Either<DecodeError, A> | ||
/** | ||
@@ -51,3 +50,6 @@ * @category DecodeError | ||
*/ | ||
export declare const failure: <A = never>(actual: unknown, message: string) => E.Either<FS.FreeSemigroup<DE.DecodeError<string>>, A>; | ||
export declare const failure: <A = never>( | ||
actual: unknown, | ||
message: string | ||
) => E.Either<FS.FreeSemigroup<DE.DecodeError<string>>, A> | ||
/** | ||
@@ -57,3 +59,3 @@ * @category constructors | ||
*/ | ||
export declare const fromRefinement: <I, A extends I>(refinement: Refinement<I, A>, expected: string) => Decoder<I, A>; | ||
export declare const fromRefinement: <I, A extends I>(refinement: Refinement<I, A>, expected: string) => Decoder<I, A> | ||
/** | ||
@@ -63,3 +65,3 @@ * @category constructors | ||
*/ | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => Decoder<I, A>; | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => Decoder<I, A> | ||
/** | ||
@@ -69,3 +71,5 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>(...values: A) => Decoder<unknown, A[number]>; | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>( | ||
...values: A | ||
) => Decoder<unknown, A[number]> | ||
/** | ||
@@ -75,3 +79,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Decoder<unknown, string>; | ||
export declare const string: Decoder<unknown, string> | ||
/** | ||
@@ -81,3 +85,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Decoder<unknown, number>; | ||
export declare const number: Decoder<unknown, number> | ||
/** | ||
@@ -87,3 +91,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Decoder<unknown, boolean>; | ||
export declare const boolean: Decoder<unknown, boolean> | ||
/** | ||
@@ -93,3 +97,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Decoder<unknown, Array<unknown>>; | ||
export declare const UnknownArray: Decoder<unknown, Array<unknown>> | ||
/** | ||
@@ -99,3 +103,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Decoder<unknown, Record<string, unknown>>; | ||
export declare const UnknownRecord: Decoder<unknown, Record<string, unknown>> | ||
/** | ||
@@ -105,3 +109,5 @@ * @category combinators | ||
*/ | ||
export declare const mapLeftWithInput: <I>(f: (input: I, e: DecodeError) => DecodeError) => <A>(decoder: Decoder<I, A>) => Decoder<I, A>; | ||
export declare const mapLeftWithInput: <I>( | ||
f: (input: I, e: DecodeError) => DecodeError | ||
) => <A>(decoder: Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -111,3 +117,5 @@ * @category combinators | ||
*/ | ||
export declare const withMessage: <I>(message: (input: I, e: DecodeError) => string) => <A>(decoder: Decoder<I, A>) => Decoder<I, A>; | ||
export declare const withMessage: <I>( | ||
message: (input: I, e: DecodeError) => string | ||
) => <A>(decoder: Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -117,3 +125,6 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => <I>(from: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => <I>(from: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -123,3 +134,5 @@ * @category combinators | ||
*/ | ||
export declare const parse: <A, B>(parser: (a: A) => E.Either<DecodeError, B>) => <I>(from: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const parse: <A, B>( | ||
parser: (a: A) => E.Either<DecodeError, B> | ||
) => <I>(from: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -129,3 +142,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <I, A>(or: Decoder<I, A>) => Decoder<null | I, null | A>; | ||
export declare const nullable: <I, A>(or: Decoder<I, A>) => Decoder<null | I, null | A> | ||
/** | ||
@@ -135,3 +148,5 @@ * @category combinators | ||
*/ | ||
export declare const fromType: <P extends Record<string, Decoder<any, any>>>(properties: P) => Decoder<{ [K in keyof P]: K.InputOf<"Either", P[K]>; }, { [K_1 in keyof P]: K.TypeOf<"Either", P[K_1]>; }>; | ||
export declare const fromType: <P extends Record<string, Decoder<any, any>>>( | ||
properties: P | ||
) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> | ||
/** | ||
@@ -141,3 +156,5 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, { [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>( | ||
properties: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -147,3 +164,8 @@ * @category combinators | ||
*/ | ||
export declare const fromPartial: <P extends Record<string, Decoder<any, any>>>(properties: P) => Decoder<Partial<{ [K in keyof P]: K.InputOf<"Either", P[K]>; }>, Partial<{ [K_1 in keyof P]: K.TypeOf<"Either", P[K_1]>; }>>; | ||
export declare const fromPartial: <P extends Record<string, Decoder<any, any>>>( | ||
properties: P | ||
) => Decoder< | ||
Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, | ||
Partial<{ [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> | ||
> | ||
/** | ||
@@ -153,3 +175,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -159,3 +183,3 @@ * @category combinators | ||
*/ | ||
export declare const fromArray: <I, A>(item: Decoder<I, A>) => Decoder<I[], A[]>; | ||
export declare const fromArray: <I, A>(item: Decoder<I, A>) => Decoder<I[], A[]> | ||
/** | ||
@@ -165,3 +189,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: Decoder<unknown, A>) => Decoder<unknown, A[]>; | ||
export declare const array: <A>(item: Decoder<unknown, A>) => Decoder<unknown, A[]> | ||
/** | ||
@@ -171,3 +195,3 @@ * @category combinators | ||
*/ | ||
export declare const fromRecord: <I, A>(codomain: Decoder<I, A>) => Decoder<Record<string, I>, Record<string, A>>; | ||
export declare const fromRecord: <I, A>(codomain: Decoder<I, A>) => Decoder<Record<string, I>, Record<string, A>> | ||
/** | ||
@@ -177,3 +201,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Decoder<unknown, A>) => Decoder<unknown, Record<string, A>>; | ||
export declare const record: <A>(codomain: Decoder<unknown, A>) => Decoder<unknown, Record<string, A>> | ||
/** | ||
@@ -183,3 +207,5 @@ * @category combinators | ||
*/ | ||
export declare const fromTuple: <C extends readonly Decoder<any, any>[]>(...components: C) => Decoder<{ [K in keyof C]: K.InputOf<"Either", C[K]>; }, { [K_1 in keyof C]: K.TypeOf<"Either", C[K_1]>; }>; | ||
export declare const fromTuple: <C extends readonly Decoder<any, any>[]>( | ||
...components: C | ||
) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K_1 in keyof C]: K.TypeOf<'Either', C[K_1]> }> | ||
/** | ||
@@ -189,3 +215,5 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, A>; | ||
export declare const tuple: <A extends readonly unknown[]>( | ||
...components: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, A> | ||
/** | ||
@@ -195,3 +223,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <MS extends readonly [Decoder<any, any>, ...Array<Decoder<any, any>>]>(...members: MS) => Decoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>>; | ||
export declare const union: <MS extends readonly [Decoder<any, any>, ...Array<Decoder<any, any>>]>( | ||
...members: MS | ||
) => Decoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -201,3 +231,5 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <IB, B>(right: Decoder<IB, B>) => <IA, A>(left: Decoder<IA, A>) => Decoder<IA & IB, A & B>; | ||
export declare const intersect: <IB, B>( | ||
right: Decoder<IB, B> | ||
) => <IA, A>(left: Decoder<IA, A>) => Decoder<IA & IB, A & B> | ||
/** | ||
@@ -207,3 +239,7 @@ * @category combinators | ||
*/ | ||
export declare const fromSum: <T extends string>(tag: T) => <MS extends Record<string, Decoder<any, any>>>(members: MS) => Decoder<K.InputOf<"Either", MS[keyof MS]>, K.TypeOf<"Either", MS[keyof MS]>>; | ||
export declare const fromSum: <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, Decoder<any, any>>>( | ||
members: MS | ||
) => Decoder<K.InputOf<'Either', MS[keyof MS]>, K.TypeOf<'Either', MS[keyof MS]>> | ||
/** | ||
@@ -213,3 +249,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(tag: T) => <A>(members: { [K in keyof A]: Decoder<unknown, A[K]>; }) => Decoder<unknown, A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
tag: T | ||
) => <A>(members: { [K in keyof A]: Decoder<unknown, A[K]> }) => Decoder<unknown, A[keyof A]> | ||
/** | ||
@@ -219,3 +257,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <I, A>(id: string, f: () => Decoder<I, A>) => Decoder<I, A>; | ||
export declare const lazy: <I, A>(id: string, f: () => Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -225,3 +263,3 @@ * @category Functor | ||
*/ | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -231,3 +269,3 @@ * @category Alt | ||
*/ | ||
export declare const alt: <I, A>(that: () => Decoder<I, A>) => (me: Decoder<I, A>) => Decoder<I, A>; | ||
export declare const alt: <I, A>(that: () => Decoder<I, A>) => (me: Decoder<I, A>) => Decoder<I, A> | ||
/** | ||
@@ -237,3 +275,3 @@ * @category Semigroupoid | ||
*/ | ||
export declare const compose: <A, B>(to: Decoder<A, B>) => <I>(from: Decoder<I, A>) => Decoder<I, B>; | ||
export declare const compose: <A, B>(to: Decoder<A, B>) => <I>(from: Decoder<I, A>) => Decoder<I, B> | ||
/** | ||
@@ -243,3 +281,3 @@ * @category Category | ||
*/ | ||
export declare const id: <A>() => Decoder<A, A>; | ||
export declare const id: <A>() => Decoder<A, A> | ||
/** | ||
@@ -249,3 +287,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Decoder"; | ||
export declare const URI = 'io-ts/Decoder' | ||
/** | ||
@@ -255,7 +293,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Decoder<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Decoder<E, A> | ||
} | ||
} | ||
@@ -266,3 +304,3 @@ /** | ||
*/ | ||
export declare const Functor: Functor2<URI>; | ||
export declare const Functor: Functor2<URI> | ||
/** | ||
@@ -272,3 +310,3 @@ * @category instances | ||
*/ | ||
export declare const Alt: Alt2<URI>; | ||
export declare const Alt: Alt2<URI> | ||
/** | ||
@@ -278,3 +316,3 @@ * @category instances | ||
*/ | ||
export declare const Category: Category2<URI>; | ||
export declare const Category: Category2<URI> | ||
/** | ||
@@ -284,3 +322,3 @@ * @category instances | ||
*/ | ||
export declare const Schemable: S.Schemable2C<URI, unknown>; | ||
export declare const Schemable: S.Schemable2C<URI, unknown> | ||
/** | ||
@@ -290,3 +328,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown>; | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown> | ||
/** | ||
@@ -296,3 +334,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown>; | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown> | ||
/** | ||
@@ -302,14 +340,14 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown>; | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown> | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<D> = K.InputOf<E.URI, D>; | ||
export declare type InputOf<D> = K.InputOf<E.URI, D> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type TypeOf<D> = K.TypeOf<E.URI, D>; | ||
export declare type TypeOf<D> = K.TypeOf<E.URI, D> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare const draw: (e: DecodeError) => string; | ||
export declare const draw: (e: DecodeError) => string |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringify = exports.draw = exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.Category = exports.Alt = exports.Functor = exports.URI = exports.id = exports.compose = exports.alt = exports.map = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.union = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.fromType = exports.nullable = exports.parse = exports.refine = exports.withMessage = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromGuard = exports.fromRefinement = exports.failure = exports.success = exports.error = exports.ap = exports.SE = void 0; | ||
var E = require("fp-ts/lib/Either"); | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var DE = require("./DecodeError"); | ||
var FS = require("./FreeSemigroup"); | ||
var G = require("./Guard"); | ||
var K = require("./Kleisli"); | ||
var DE = __importStar(require("./DecodeError")); | ||
var FS = __importStar(require("./FreeSemigroup")); | ||
var G = __importStar(require("./Guard")); | ||
var K = __importStar(require("./Kleisli")); | ||
// ------------------------------------------------------------------------------------- | ||
@@ -11,0 +30,0 @@ // Kleisli config |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import { Contravariant2 } from 'fp-ts/lib/Contravariant'; | ||
import { Category2 } from 'fp-ts/lib/Category'; | ||
import { Contravariant2 } from 'fp-ts/lib/Contravariant' | ||
import { Category2 } from 'fp-ts/lib/Category' | ||
/** | ||
@@ -19,3 +19,3 @@ * @category model | ||
export interface Encoder<O, A> { | ||
readonly encode: (a: A) => O; | ||
readonly encode: (a: A) => O | ||
} | ||
@@ -26,3 +26,3 @@ /** | ||
*/ | ||
export declare function nullable<O, A>(or: Encoder<O, A>): Encoder<null | O, null | A>; | ||
export declare function nullable<O, A>(or: Encoder<O, A>): Encoder<null | O, null | A> | ||
/** | ||
@@ -32,7 +32,12 @@ * @category combinators | ||
*/ | ||
export declare function type<P extends Record<string, Encoder<any, any>>>(properties: P): Encoder<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>; | ||
export declare function type<P extends Record<string, Encoder<any, any>>>( | ||
properties: P | ||
): Encoder< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
/** | ||
@@ -42,7 +47,16 @@ * @category combinators | ||
*/ | ||
export declare function partial<P extends Record<string, Encoder<any, any>>>(properties: P): Encoder<Partial<{ | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}>, Partial<{ | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}>>; | ||
export declare function partial<P extends Record<string, Encoder<any, any>>>( | ||
properties: P | ||
): Encoder< | ||
Partial< | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
>, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -52,3 +66,3 @@ * @category combinators | ||
*/ | ||
export declare function record<O, A>(codomain: Encoder<O, A>): Encoder<Record<string, O>, Record<string, A>>; | ||
export declare function record<O, A>(codomain: Encoder<O, A>): Encoder<Record<string, O>, Record<string, A>> | ||
/** | ||
@@ -58,3 +72,3 @@ * @category combinators | ||
*/ | ||
export declare function array<O, A>(item: Encoder<O, A>): Encoder<Array<O>, Array<A>>; | ||
export declare function array<O, A>(item: Encoder<O, A>): Encoder<Array<O>, Array<A>> | ||
/** | ||
@@ -64,7 +78,12 @@ * @category combinators | ||
*/ | ||
export declare function tuple<C extends ReadonlyArray<Encoder<any, any>>>(...components: C): Encoder<{ | ||
[K in keyof C]: OutputOf<C[K]>; | ||
}, { | ||
[K in keyof C]: TypeOf<C[K]>; | ||
}>; | ||
export declare function tuple<C extends ReadonlyArray<Encoder<any, any>>>( | ||
...components: C | ||
): Encoder< | ||
{ | ||
[K in keyof C]: OutputOf<C[K]> | ||
}, | ||
{ | ||
[K in keyof C]: TypeOf<C[K]> | ||
} | ||
> | ||
/** | ||
@@ -74,3 +93,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <P, B>(right: Encoder<P, B>) => <O, A>(left: Encoder<O, A>) => Encoder<O & P, A & B>; | ||
export declare const intersect: <P, B>(right: Encoder<P, B>) => <O, A>(left: Encoder<O, A>) => Encoder<O & P, A & B> | ||
/** | ||
@@ -80,3 +99,5 @@ * @category combinators | ||
*/ | ||
export declare function sum<T extends string>(tag: T): <MS extends Record<string, Encoder<any, any>>>(members: MS) => Encoder<OutputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>>; | ||
export declare function sum<T extends string>( | ||
tag: T | ||
): <MS extends Record<string, Encoder<any, any>>>(members: MS) => Encoder<OutputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -86,3 +107,3 @@ * @category combinators | ||
*/ | ||
export declare function lazy<O, A>(f: () => Encoder<O, A>): Encoder<O, A>; | ||
export declare function lazy<O, A>(f: () => Encoder<O, A>): Encoder<O, A> | ||
/** | ||
@@ -92,3 +113,3 @@ * @category Contravariant | ||
*/ | ||
export declare const contramap: <A, B>(f: (b: B) => A) => <E>(fa: Encoder<E, A>) => Encoder<E, B>; | ||
export declare const contramap: <A, B>(f: (b: B) => A) => <E>(fa: Encoder<E, A>) => Encoder<E, B> | ||
/** | ||
@@ -98,3 +119,3 @@ * @category Semigroupoid | ||
*/ | ||
export declare const compose: <E, A>(ea: Encoder<E, A>) => <B>(ab: Encoder<A, B>) => Encoder<E, B>; | ||
export declare const compose: <E, A>(ea: Encoder<E, A>) => <B>(ab: Encoder<A, B>) => Encoder<E, B> | ||
/** | ||
@@ -104,3 +125,3 @@ * @category Category | ||
*/ | ||
export declare function id<A>(): Encoder<A, A>; | ||
export declare function id<A>(): Encoder<A, A> | ||
/** | ||
@@ -110,3 +131,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Encoder"; | ||
export declare const URI = 'io-ts/Encoder' | ||
/** | ||
@@ -116,7 +137,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Encoder<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: Encoder<E, A> | ||
} | ||
} | ||
@@ -127,3 +148,3 @@ /** | ||
*/ | ||
export declare const Contravariant: Contravariant2<URI>; | ||
export declare const Contravariant: Contravariant2<URI> | ||
/** | ||
@@ -133,10 +154,10 @@ * @category instances | ||
*/ | ||
export declare const Category: Category2<URI>; | ||
export declare const Category: Category2<URI> | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type TypeOf<E> = E extends Encoder<any, infer A> ? A : never; | ||
export declare type TypeOf<E> = E extends Encoder<any, infer A> ? A : never | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type OutputOf<E> = E extends Encoder<infer O, any> ? O : never; | ||
export declare type OutputOf<E> = E extends Encoder<infer O, any> ? O : never |
@@ -1,12 +0,12 @@ | ||
import * as E from 'fp-ts/lib/Eq'; | ||
import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable'; | ||
import Eq = E.Eq; | ||
import * as E from 'fp-ts/lib/Eq' | ||
import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' | ||
import Eq = E.Eq | ||
/** | ||
* @since 2.2.3 | ||
*/ | ||
export declare type URI = E.URI; | ||
export declare type URI = E.URI | ||
/** | ||
* @since 2.2.2 | ||
*/ | ||
export declare type TypeOf<E> = E extends Eq<infer A> ? A : never; | ||
export declare type TypeOf<E> = E extends Eq<infer A> ? A : never | ||
/** | ||
@@ -16,3 +16,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Eq<string>; | ||
export declare const string: Eq<string> | ||
/** | ||
@@ -22,3 +22,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Eq<number>; | ||
export declare const number: Eq<number> | ||
/** | ||
@@ -28,3 +28,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Eq<boolean>; | ||
export declare const boolean: Eq<boolean> | ||
/** | ||
@@ -34,3 +34,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Eq<Array<unknown>>; | ||
export declare const UnknownArray: Eq<Array<unknown>> | ||
/** | ||
@@ -40,3 +40,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Eq<Record<string, unknown>>; | ||
export declare const UnknownRecord: Eq<Record<string, unknown>> | ||
/** | ||
@@ -46,3 +46,3 @@ * @category combinators | ||
*/ | ||
export declare function nullable<A>(or: Eq<A>): Eq<null | A>; | ||
export declare function nullable<A>(or: Eq<A>): Eq<null | A> | ||
/** | ||
@@ -52,7 +52,11 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(eqs: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}) => Eq<{ | ||
[K in keyof A]: A[K]; | ||
}>; | ||
export declare const type: <A>( | ||
eqs: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
) => Eq< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
/** | ||
@@ -62,7 +66,13 @@ * @category combinators | ||
*/ | ||
export declare function partial<A>(properties: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}): Eq<Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
export declare function partial<A>( | ||
properties: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
): Eq< | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
/** | ||
@@ -72,3 +82,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Eq<A>) => Eq<Record<string, A>>; | ||
export declare const record: <A>(codomain: Eq<A>) => Eq<Record<string, A>> | ||
/** | ||
@@ -78,3 +88,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(eq: Eq<A>) => Eq<Array<A>>; | ||
export declare const array: <A>(eq: Eq<A>) => Eq<Array<A>> | ||
/** | ||
@@ -84,5 +94,7 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}) => Eq<A>; | ||
export declare const tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
) => Eq<A> | ||
/** | ||
@@ -92,3 +104,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <B>(right: E.Eq<B>) => <A>(left: E.Eq<A>) => E.Eq<A & B>; | ||
export declare const intersect: <B>(right: E.Eq<B>) => <A>(left: E.Eq<A>) => E.Eq<A & B> | ||
/** | ||
@@ -98,5 +110,9 @@ * @category combinators | ||
*/ | ||
export declare function sum<T extends string>(tag: T): <A>(members: { | ||
[K in keyof A]: Eq<A[K]>; | ||
}) => Eq<A[keyof A]>; | ||
export declare function sum<T extends string>( | ||
tag: T | ||
): <A>( | ||
members: { | ||
[K in keyof A]: Eq<A[K]> | ||
} | ||
) => Eq<A[keyof A]> | ||
/** | ||
@@ -106,3 +122,3 @@ * @category combinators | ||
*/ | ||
export declare function lazy<A>(f: () => Eq<A>): Eq<A>; | ||
export declare function lazy<A>(f: () => Eq<A>): Eq<A> | ||
/** | ||
@@ -112,3 +128,3 @@ * @category instances | ||
*/ | ||
export declare const Schemable: Schemable1<E.URI>; | ||
export declare const Schemable: Schemable1<E.URI> | ||
/** | ||
@@ -118,3 +134,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: WithUnknownContainers1<E.URI>; | ||
export declare const WithUnknownContainers: WithUnknownContainers1<E.URI> | ||
/** | ||
@@ -124,2 +140,2 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: WithRefine1<E.URI>; | ||
export declare const WithRefine: WithRefine1<E.URI> |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -14,5 +33,5 @@ exports.WithRefine = exports.WithUnknownContainers = exports.Schemable = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.nullable = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = void 0; | ||
*/ | ||
var A = require("fp-ts/lib/Array"); | ||
var E = require("fp-ts/lib/Eq"); | ||
var R = require("fp-ts/lib/Record"); | ||
var A = __importStar(require("fp-ts/lib/Array")); | ||
var E = __importStar(require("fp-ts/lib/Eq")); | ||
var R = __importStar(require("fp-ts/lib/Record")); | ||
var Schemable_1 = require("./Schemable"); | ||
@@ -19,0 +38,0 @@ // ------------------------------------------------------------------------------------- |
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
import { Semigroup } from 'fp-ts/lib/Semigroup'; | ||
import { Semigroup } from 'fp-ts/lib/Semigroup' | ||
/** | ||
@@ -18,4 +18,4 @@ * @category model | ||
export interface Of<A> { | ||
readonly _tag: 'Of'; | ||
readonly value: A; | ||
readonly _tag: 'Of' | ||
readonly value: A | ||
} | ||
@@ -27,5 +27,5 @@ /** | ||
export interface Concat<A> { | ||
readonly _tag: 'Concat'; | ||
readonly left: FreeSemigroup<A>; | ||
readonly right: FreeSemigroup<A>; | ||
readonly _tag: 'Concat' | ||
readonly left: FreeSemigroup<A> | ||
readonly right: FreeSemigroup<A> | ||
} | ||
@@ -36,3 +36,3 @@ /** | ||
*/ | ||
export declare type FreeSemigroup<A> = Of<A> | Concat<A>; | ||
export declare type FreeSemigroup<A> = Of<A> | Concat<A> | ||
/** | ||
@@ -42,3 +42,3 @@ * @category constructors | ||
*/ | ||
export declare const of: <A>(a: A) => FreeSemigroup<A>; | ||
export declare const of: <A>(a: A) => FreeSemigroup<A> | ||
/** | ||
@@ -48,3 +48,3 @@ * @category constructors | ||
*/ | ||
export declare const concat: <A>(left: FreeSemigroup<A>, right: FreeSemigroup<A>) => FreeSemigroup<A>; | ||
export declare const concat: <A>(left: FreeSemigroup<A>, right: FreeSemigroup<A>) => FreeSemigroup<A> | ||
/** | ||
@@ -54,3 +54,6 @@ * @category destructors | ||
*/ | ||
export declare const fold: <A, R>(onOf: (value: A) => R, onConcat: (left: FreeSemigroup<A>, right: FreeSemigroup<A>) => R) => (f: FreeSemigroup<A>) => R; | ||
export declare const fold: <A, R>( | ||
onOf: (value: A) => R, | ||
onConcat: (left: FreeSemigroup<A>, right: FreeSemigroup<A>) => R | ||
) => (f: FreeSemigroup<A>) => R | ||
/** | ||
@@ -60,2 +63,2 @@ * @category instances | ||
*/ | ||
export declare function getSemigroup<A = never>(): Semigroup<FreeSemigroup<A>>; | ||
export declare function getSemigroup<A = never>(): Semigroup<FreeSemigroup<A>> |
@@ -1,2 +0,2 @@ | ||
import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable'; | ||
import { Literal, Schemable1, WithRefine1, WithUnion1, WithUnknownContainers1 } from './Schemable' | ||
/** | ||
@@ -7,3 +7,3 @@ * @category model | ||
export interface Guard<I, A extends I> { | ||
is: (i: I) => i is A; | ||
is: (i: I) => i is A | ||
} | ||
@@ -13,7 +13,7 @@ /** | ||
*/ | ||
export declare type TypeOf<G> = G extends Guard<any, infer A> ? A : never; | ||
export declare type TypeOf<G> = G extends Guard<any, infer A> ? A : never | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<G> = G extends Guard<infer I, any> ? I : never; | ||
export declare type InputOf<G> = G extends Guard<infer I, any> ? I : never | ||
/** | ||
@@ -23,3 +23,3 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Guard<unknown, A[number]>; | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Guard<unknown, A[number]> | ||
/** | ||
@@ -29,3 +29,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Guard<unknown, string>; | ||
export declare const string: Guard<unknown, string> | ||
/** | ||
@@ -37,3 +37,3 @@ * Note: `NaN` is excluded. | ||
*/ | ||
export declare const number: Guard<unknown, number>; | ||
export declare const number: Guard<unknown, number> | ||
/** | ||
@@ -43,3 +43,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Guard<unknown, boolean>; | ||
export declare const boolean: Guard<unknown, boolean> | ||
/** | ||
@@ -49,3 +49,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Guard<unknown, Array<unknown>>; | ||
export declare const UnknownArray: Guard<unknown, Array<unknown>> | ||
/** | ||
@@ -55,3 +55,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Guard<unknown, Record<string, unknown>>; | ||
export declare const UnknownRecord: Guard<unknown, Record<string, unknown>> | ||
/** | ||
@@ -61,3 +61,5 @@ * @category combinators | ||
*/ | ||
export declare const refine: <I, A extends I, B extends A>(refinement: (a: A) => a is B) => (from: Guard<I, A>) => Guard<I, B>; | ||
export declare const refine: <I, A extends I, B extends A>( | ||
refinement: (a: A) => a is B | ||
) => (from: Guard<I, A>) => Guard<I, B> | ||
/** | ||
@@ -67,3 +69,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <I, A extends I>(or: Guard<I, A>) => Guard<I | null, A | null>; | ||
export declare const nullable: <I, A extends I>(or: Guard<I, A>) => Guard<I | null, A | null> | ||
/** | ||
@@ -73,3 +75,5 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, { [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>( | ||
properties: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -79,3 +83,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -85,3 +91,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: Guard<unknown, A>) => Guard<unknown, A[]>; | ||
export declare const array: <A>(item: Guard<unknown, A>) => Guard<unknown, A[]> | ||
/** | ||
@@ -91,3 +97,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Guard<unknown, A>) => Guard<unknown, Record<string, A>>; | ||
export declare const record: <A>(codomain: Guard<unknown, A>) => Guard<unknown, Record<string, A>> | ||
/** | ||
@@ -97,3 +103,5 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, A>; | ||
export declare const tuple: <A extends readonly unknown[]>( | ||
...components: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, A> | ||
/** | ||
@@ -103,3 +111,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <B>(right: Guard<unknown, B>) => <A>(left: Guard<unknown, A>) => Guard<unknown, A & B>; | ||
export declare const intersect: <B>(right: Guard<unknown, B>) => <A>(left: Guard<unknown, A>) => Guard<unknown, A & B> | ||
/** | ||
@@ -109,3 +117,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>(...members: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, A[number]>; | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>( | ||
...members: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, A[number]> | ||
/** | ||
@@ -115,3 +125,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(tag: T) => <A>(members: { [K in keyof A]: Guard<unknown, A[K]>; }) => Guard<unknown, A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
tag: T | ||
) => <A>(members: { [K in keyof A]: Guard<unknown, A[K]> }) => Guard<unknown, A[keyof A]> | ||
/** | ||
@@ -121,3 +133,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <A>(f: () => Guard<unknown, A>) => Guard<unknown, A>; | ||
export declare const lazy: <A>(f: () => Guard<unknown, A>) => Guard<unknown, A> | ||
/** | ||
@@ -127,3 +139,3 @@ * @category combinators | ||
*/ | ||
export declare const alt: <I, A extends I>(that: () => Guard<I, A>) => (me: Guard<I, A>) => Guard<I, A>; | ||
export declare const alt: <I, A extends I>(that: () => Guard<I, A>) => (me: Guard<I, A>) => Guard<I, A> | ||
/** | ||
@@ -133,3 +145,3 @@ * @category combinators | ||
*/ | ||
export declare const zero: <I, A extends I>() => Guard<I, A>; | ||
export declare const zero: <I, A extends I>() => Guard<I, A> | ||
/** | ||
@@ -139,3 +151,3 @@ * @category combinators | ||
*/ | ||
export declare const compose: <I, A extends I, B extends A>(to: Guard<A, B>) => (from: Guard<I, A>) => Guard<I, B>; | ||
export declare const compose: <I, A extends I, B extends A>(to: Guard<A, B>) => (from: Guard<I, A>) => Guard<I, B> | ||
/** | ||
@@ -145,3 +157,3 @@ * @category combinators | ||
*/ | ||
export declare const id: <A>() => Guard<A, A>; | ||
export declare const id: <A>() => Guard<A, A> | ||
/** | ||
@@ -151,3 +163,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Guard"; | ||
export declare const URI = 'io-ts/Guard' | ||
/** | ||
@@ -157,7 +169,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind<A> { | ||
readonly [URI]: Guard<unknown, A>; | ||
} | ||
interface URItoKind<A> { | ||
readonly [URI]: Guard<unknown, A> | ||
} | ||
} | ||
@@ -168,3 +180,3 @@ /** | ||
*/ | ||
export declare const Schemable: Schemable1<URI>; | ||
export declare const Schemable: Schemable1<URI> | ||
/** | ||
@@ -174,3 +186,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI>; | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI> | ||
/** | ||
@@ -180,3 +192,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: WithUnion1<URI>; | ||
export declare const WithUnion: WithUnion1<URI> | ||
/** | ||
@@ -186,2 +198,2 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: WithRefine1<URI>; | ||
export declare const WithRefine: WithRefine1<URI> |
1256
lib/index.d.ts
/** | ||
* @since 1.0.0 | ||
*/ | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { Predicate, Refinement } from 'fp-ts/lib/function'; | ||
import { Either } from 'fp-ts/lib/Either' | ||
import { Predicate, Refinement } from 'fp-ts/lib/function' | ||
/** | ||
@@ -11,6 +11,6 @@ * @category Model | ||
export interface ContextEntry { | ||
readonly key: string; | ||
readonly type: Decoder<any, any>; | ||
/** the input data */ | ||
readonly actual?: unknown; | ||
readonly key: string | ||
readonly type: Decoder<any, any> | ||
/** the input data */ | ||
readonly actual?: unknown | ||
} | ||
@@ -21,4 +21,3 @@ /** | ||
*/ | ||
export interface Context extends ReadonlyArray<ContextEntry> { | ||
} | ||
export interface Context extends ReadonlyArray<ContextEntry> {} | ||
/** | ||
@@ -29,8 +28,8 @@ * @category Model | ||
export interface ValidationError { | ||
/** the offending (sub)value */ | ||
readonly value: unknown; | ||
/** where the error originated */ | ||
readonly context: Context; | ||
/** optional custom error message */ | ||
readonly message?: string; | ||
/** the offending (sub)value */ | ||
readonly value: unknown | ||
/** where the error originated */ | ||
readonly context: Context | ||
/** optional custom error message */ | ||
readonly message?: string | ||
} | ||
@@ -41,4 +40,3 @@ /** | ||
*/ | ||
export interface Errors extends Array<ValidationError> { | ||
} | ||
export interface Errors extends Array<ValidationError> {} | ||
/** | ||
@@ -48,3 +46,3 @@ * @category Model | ||
*/ | ||
export declare type Validation<A> = Either<Errors, A>; | ||
export declare type Validation<A> = Either<Errors, A> | ||
/** | ||
@@ -54,3 +52,3 @@ * @category Model | ||
*/ | ||
export declare type Is<A> = (u: unknown) => u is A; | ||
export declare type Is<A> = (u: unknown) => u is A | ||
/** | ||
@@ -60,3 +58,3 @@ * @category Model | ||
*/ | ||
export declare type Validate<I, A> = (i: I, context: Context) => Validation<A>; | ||
export declare type Validate<I, A> = (i: I, context: Context) => Validation<A> | ||
/** | ||
@@ -66,3 +64,3 @@ * @category Model | ||
*/ | ||
export declare type Decode<I, A> = (i: I) => Validation<A>; | ||
export declare type Decode<I, A> = (i: I) => Validation<A> | ||
/** | ||
@@ -72,25 +70,23 @@ * @category Model | ||
*/ | ||
export declare type Encode<A, O> = (a: A) => O; | ||
export declare type Encode<A, O> = (a: A) => O | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export interface Any extends Type<any, any, any> { | ||
} | ||
export interface Any extends Type<any, any, any> {} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export interface Mixed extends Type<any, any, unknown> { | ||
} | ||
export interface Mixed extends Type<any, any, unknown> {} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare type TypeOf<C extends Any> = C['_A']; | ||
export declare type TypeOf<C extends Any> = C['_A'] | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare type InputOf<C extends Any> = C['_I']; | ||
export declare type InputOf<C extends Any> = C['_I'] | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare type OutputOf<C extends Any> = C['_O']; | ||
export declare type OutputOf<C extends Any> = C['_O'] | ||
/** | ||
@@ -101,5 +97,5 @@ * @category Model | ||
export interface Decoder<I, A> { | ||
readonly name: string; | ||
readonly validate: Validate<I, A>; | ||
readonly decode: Decode<I, A>; | ||
readonly name: string | ||
readonly validate: Validate<I, A> | ||
readonly decode: Decode<I, A> | ||
} | ||
@@ -111,3 +107,3 @@ /** | ||
export interface Encoder<A, O> { | ||
readonly encode: Encode<A, O>; | ||
readonly encode: Encode<A, O> | ||
} | ||
@@ -119,48 +115,49 @@ /** | ||
export declare class Type<A, O = A, I = unknown> implements Decoder<I, A>, Encoder<A, O> { | ||
/** a unique name for this codec */ | ||
readonly name: string | ||
/** a custom type guard */ | ||
readonly is: Is<A> | ||
/** succeeds if a value of type I can be decoded to a value of type A */ | ||
readonly validate: Validate<I, A> | ||
/** converts a value of type A to a value of type O */ | ||
readonly encode: Encode<A, O> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _A: A | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _O: O | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _I: I | ||
constructor( | ||
/** a unique name for this codec */ | ||
readonly name: string; | ||
name: string, | ||
/** a custom type guard */ | ||
readonly is: Is<A>; | ||
is: Is<A>, | ||
/** succeeds if a value of type I can be decoded to a value of type A */ | ||
readonly validate: Validate<I, A>; | ||
validate: Validate<I, A>, | ||
/** converts a value of type A to a value of type O */ | ||
readonly encode: Encode<A, O>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _A: A; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _O: O; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _I: I; | ||
constructor( | ||
/** a unique name for this codec */ | ||
name: string, | ||
/** a custom type guard */ | ||
is: Is<A>, | ||
/** succeeds if a value of type I can be decoded to a value of type A */ | ||
validate: Validate<I, A>, | ||
/** converts a value of type A to a value of type O */ | ||
encode: Encode<A, O>); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
pipe<B, IB, A extends IB, OB extends A>(this: Type<A, O, I>, ab: Type<B, OB, IB>, name?: string): Type<B, O, I>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asDecoder(): Decoder<I, A>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asEncoder(): Encoder<A, O>; | ||
/** | ||
* a version of `validate` with a default context | ||
* @since 1.0.0 | ||
*/ | ||
decode(i: I): Validation<A>; | ||
encode: Encode<A, O> | ||
) | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
pipe<B, IB, A extends IB, OB extends A>(this: Type<A, O, I>, ab: Type<B, OB, IB>, name?: string): Type<B, O, I> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asDecoder(): Decoder<I, A> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
asEncoder(): Encoder<A, O> | ||
/** | ||
* a version of `validate` with a default context | ||
* @since 1.0.0 | ||
*/ | ||
decode(i: I): Validation<A> | ||
} | ||
@@ -170,27 +167,27 @@ /** | ||
*/ | ||
export declare const identity: <A>(a: A) => A; | ||
export declare const identity: <A>(a: A) => A | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const getFunctionName: (f: Function) => string; | ||
export declare const getFunctionName: (f: Function) => string | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const getContextEntry: (key: string, decoder: Decoder<any, any>) => ContextEntry; | ||
export declare const getContextEntry: (key: string, decoder: Decoder<any, any>) => ContextEntry | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const appendContext: (c: Context, key: string, decoder: Decoder<any, any>, actual?: unknown) => Context; | ||
export declare const appendContext: (c: Context, key: string, decoder: Decoder<any, any>, actual?: unknown) => Context | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const failures: <T>(errors: Errors) => Validation<T>; | ||
export declare const failures: <T>(errors: Errors) => Validation<T> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const failure: <T>(value: unknown, context: Context, message?: string | undefined) => Either<Errors, T>; | ||
export declare const failure: <T>(value: unknown, context: Context, message?: string | undefined) => Either<Errors, T> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const success: <T>(value: T) => Validation<T>; | ||
export declare const success: <T>(value: T) => Validation<T> | ||
/** | ||
@@ -200,7 +197,7 @@ * @since 1.0.0 | ||
export declare class NullType extends Type<null> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NullType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NullType' | ||
constructor() | ||
} | ||
@@ -210,4 +207,3 @@ /** | ||
*/ | ||
export interface NullC extends NullType { | ||
} | ||
export interface NullC extends NullType {} | ||
/** | ||
@@ -217,3 +213,3 @@ * @category Primitives | ||
*/ | ||
export declare const nullType: NullC; | ||
export declare const nullType: NullC | ||
/** | ||
@@ -223,7 +219,7 @@ * @since 1.0.0 | ||
export declare class UndefinedType extends Type<undefined> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UndefinedType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UndefinedType' | ||
constructor() | ||
} | ||
@@ -233,5 +229,4 @@ /** | ||
*/ | ||
export interface UndefinedC extends UndefinedType { | ||
} | ||
declare const undefinedType: UndefinedC; | ||
export interface UndefinedC extends UndefinedType {} | ||
declare const undefinedType: UndefinedC | ||
/** | ||
@@ -241,7 +236,7 @@ * @since 1.2.0 | ||
export declare class VoidType extends Type<void> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'VoidType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'VoidType' | ||
constructor() | ||
} | ||
@@ -251,4 +246,3 @@ /** | ||
*/ | ||
export interface VoidC extends VoidType { | ||
} | ||
export interface VoidC extends VoidType {} | ||
/** | ||
@@ -258,3 +252,3 @@ * @category Primitives | ||
*/ | ||
export declare const voidType: VoidC; | ||
export declare const voidType: VoidC | ||
/** | ||
@@ -264,7 +258,7 @@ * @since 1.5.0 | ||
export declare class UnknownType extends Type<unknown> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnknownType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnknownType' | ||
constructor() | ||
} | ||
@@ -274,4 +268,3 @@ /** | ||
*/ | ||
export interface UnknownC extends UnknownType { | ||
} | ||
export interface UnknownC extends UnknownType {} | ||
/** | ||
@@ -281,3 +274,3 @@ * @category Primitives | ||
*/ | ||
export declare const unknown: UnknownC; | ||
export declare const unknown: UnknownC | ||
/** | ||
@@ -287,7 +280,7 @@ * @since 1.0.0 | ||
export declare class StringType extends Type<string> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StringType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StringType' | ||
constructor() | ||
} | ||
@@ -297,4 +290,3 @@ /** | ||
*/ | ||
export interface StringC extends StringType { | ||
} | ||
export interface StringC extends StringType {} | ||
/** | ||
@@ -304,3 +296,3 @@ * @category Primitives | ||
*/ | ||
export declare const string: StringC; | ||
export declare const string: StringC | ||
/** | ||
@@ -310,7 +302,7 @@ * @since 1.0.0 | ||
export declare class NumberType extends Type<number> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NumberType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NumberType' | ||
constructor() | ||
} | ||
@@ -320,4 +312,3 @@ /** | ||
*/ | ||
export interface NumberC extends NumberType { | ||
} | ||
export interface NumberC extends NumberType {} | ||
/** | ||
@@ -327,3 +318,3 @@ * @category Primitives | ||
*/ | ||
export declare const number: NumberC; | ||
export declare const number: NumberC | ||
/** | ||
@@ -333,7 +324,7 @@ * @since 2.1.0 | ||
export declare class BigIntType extends Type<bigint> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BigIntType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BigIntType' | ||
constructor() | ||
} | ||
@@ -343,4 +334,3 @@ /** | ||
*/ | ||
export interface BigIntC extends BigIntType { | ||
} | ||
export interface BigIntC extends BigIntType {} | ||
/** | ||
@@ -350,3 +340,3 @@ * @category Primitives | ||
*/ | ||
export declare const bigint: BigIntC; | ||
export declare const bigint: BigIntC | ||
/** | ||
@@ -356,7 +346,7 @@ * @since 1.0.0 | ||
export declare class BooleanType extends Type<boolean> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BooleanType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'BooleanType' | ||
constructor() | ||
} | ||
@@ -366,4 +356,3 @@ /** | ||
*/ | ||
export interface BooleanC extends BooleanType { | ||
} | ||
export interface BooleanC extends BooleanType {} | ||
/** | ||
@@ -373,3 +362,3 @@ * @category Primitives | ||
*/ | ||
export declare const boolean: BooleanC; | ||
export declare const boolean: BooleanC | ||
/** | ||
@@ -379,7 +368,7 @@ * @since 1.0.0 | ||
export declare class AnyArrayType extends Type<Array<unknown>> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyArrayType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyArrayType' | ||
constructor() | ||
} | ||
@@ -389,4 +378,3 @@ /** | ||
*/ | ||
export interface UnknownArrayC extends AnyArrayType { | ||
} | ||
export interface UnknownArrayC extends AnyArrayType {} | ||
/** | ||
@@ -396,3 +384,3 @@ * @category Primitives | ||
*/ | ||
export declare const UnknownArray: UnknownArrayC; | ||
export declare const UnknownArray: UnknownArrayC | ||
/** | ||
@@ -402,9 +390,9 @@ * @since 1.0.0 | ||
export declare class AnyDictionaryType extends Type<{ | ||
[key: string]: unknown; | ||
[key: string]: unknown | ||
}> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyDictionaryType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyDictionaryType' | ||
constructor() | ||
} | ||
@@ -415,8 +403,7 @@ /** | ||
*/ | ||
export declare const UnknownRecord: UnknownRecordC; | ||
export declare const UnknownRecord: UnknownRecordC | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface UnknownRecordC extends AnyDictionaryType { | ||
} | ||
export interface UnknownRecordC extends AnyDictionaryType {} | ||
/** | ||
@@ -428,7 +415,7 @@ * @category deprecated | ||
export declare class FunctionType extends Type<Function> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'FunctionType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'FunctionType' | ||
constructor() | ||
} | ||
@@ -440,4 +427,3 @@ /** | ||
*/ | ||
export interface FunctionC extends FunctionType { | ||
} | ||
export interface FunctionC extends FunctionType {} | ||
/** | ||
@@ -448,3 +434,3 @@ * @category deprecated | ||
*/ | ||
export declare const Function: FunctionC; | ||
export declare const Function: FunctionC | ||
/** | ||
@@ -454,11 +440,18 @@ * @since 1.0.0 | ||
export declare class RefinementType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
readonly predicate: Predicate<A>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RefinementType'; | ||
constructor(name: string, is: RefinementType<C, A, O, I>['is'], validate: RefinementType<C, A, O, I>['validate'], encode: RefinementType<C, A, O, I>['encode'], type: C, predicate: Predicate<A>); | ||
readonly type: C | ||
readonly predicate: Predicate<A> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RefinementType' | ||
constructor( | ||
name: string, | ||
is: RefinementType<C, A, O, I>['is'], | ||
validate: RefinementType<C, A, O, I>['validate'], | ||
encode: RefinementType<C, A, O, I>['encode'], | ||
type: C, | ||
predicate: Predicate<A> | ||
) | ||
} | ||
declare const _brand: unique symbol; | ||
declare const _brand: unique symbol | ||
/** | ||
@@ -468,3 +461,3 @@ * @since 1.8.1 | ||
export interface Brand<B> { | ||
readonly [_brand]: B; | ||
readonly [_brand]: B | ||
} | ||
@@ -474,8 +467,7 @@ /** | ||
*/ | ||
export declare type Branded<A, B> = A & Brand<B>; | ||
export declare type Branded<A, B> = A & Brand<B> | ||
/** | ||
* @since 1.8.1 | ||
*/ | ||
export interface BrandC<C extends Any, B> extends RefinementType<C, Branded<TypeOf<C>, B>, OutputOf<C>, InputOf<C>> { | ||
} | ||
export interface BrandC<C extends Any, B> extends RefinementType<C, Branded<TypeOf<C>, B>, OutputOf<C>, InputOf<C>> {} | ||
/** | ||
@@ -485,3 +477,7 @@ * @category Combinators | ||
*/ | ||
export declare const brand: <C extends Any, N extends string, B extends { readonly [K in N]: symbol; }>(codec: C, predicate: Refinement<C["_A"], Branded<C["_A"], B>>, name: N) => BrandC<C, B>; | ||
export declare const brand: <C extends Any, N extends string, B extends { readonly [K in N]: symbol }>( | ||
codec: C, | ||
predicate: Refinement<C['_A'], Branded<C['_A'], B>>, | ||
name: N | ||
) => BrandC<C, B> | ||
/** | ||
@@ -491,3 +487,3 @@ * @since 1.8.1 | ||
export interface IntBrand { | ||
readonly Int: unique symbol; | ||
readonly Int: unique symbol | ||
} | ||
@@ -500,8 +496,8 @@ /** | ||
*/ | ||
export declare const Int: BrandC<NumberC, IntBrand>; | ||
export declare const Int: BrandC<NumberC, IntBrand> | ||
/** | ||
* @since 1.8.1 | ||
*/ | ||
export declare type Int = Branded<number, IntBrand>; | ||
declare type LiteralValue = string | number | boolean; | ||
export declare type Int = Branded<number, IntBrand> | ||
declare type LiteralValue = string | number | boolean | ||
/** | ||
@@ -511,8 +507,14 @@ * @since 1.0.0 | ||
export declare class LiteralType<V extends LiteralValue> extends Type<V> { | ||
readonly value: V; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'LiteralType'; | ||
constructor(name: string, is: LiteralType<V>['is'], validate: LiteralType<V>['validate'], encode: LiteralType<V>['encode'], value: V); | ||
readonly value: V | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'LiteralType' | ||
constructor( | ||
name: string, | ||
is: LiteralType<V>['is'], | ||
validate: LiteralType<V>['validate'], | ||
encode: LiteralType<V>['encode'], | ||
value: V | ||
) | ||
} | ||
@@ -522,4 +524,3 @@ /** | ||
*/ | ||
export interface LiteralC<V extends LiteralValue> extends LiteralType<V> { | ||
} | ||
export interface LiteralC<V extends LiteralValue> extends LiteralType<V> {} | ||
/** | ||
@@ -529,15 +530,23 @@ * @category Combinators | ||
*/ | ||
export declare const literal: <V extends string | number | boolean>(value: V, name?: string) => LiteralC<V>; | ||
export declare const literal: <V extends string | number | boolean>(value: V, name?: string) => LiteralC<V> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare class KeyofType<D extends { | ||
[key: string]: unknown; | ||
}> extends Type<keyof D> { | ||
readonly keys: D; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'KeyofType'; | ||
constructor(name: string, is: KeyofType<D>['is'], validate: KeyofType<D>['validate'], encode: KeyofType<D>['encode'], keys: D); | ||
export declare class KeyofType< | ||
D extends { | ||
[key: string]: unknown | ||
} | ||
> extends Type<keyof D> { | ||
readonly keys: D | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'KeyofType' | ||
constructor( | ||
name: string, | ||
is: KeyofType<D>['is'], | ||
validate: KeyofType<D>['validate'], | ||
encode: KeyofType<D>['encode'], | ||
keys: D | ||
) | ||
} | ||
@@ -547,6 +556,7 @@ /** | ||
*/ | ||
export interface KeyofC<D extends { | ||
[key: string]: unknown; | ||
}> extends KeyofType<D> { | ||
} | ||
export interface KeyofC< | ||
D extends { | ||
[key: string]: unknown | ||
} | ||
> extends KeyofType<D> {} | ||
/** | ||
@@ -557,4 +567,7 @@ * @category Combinators | ||
export declare const keyof: <D extends { | ||
[key: string]: unknown; | ||
}>(keys: D, name?: string) => KeyofC<D>; | ||
[key: string]: unknown | ||
}>( | ||
keys: D, | ||
name?: string | ||
) => KeyofC<D> | ||
/** | ||
@@ -564,12 +577,18 @@ * @since 1.0.0 | ||
export declare class RecursiveType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
runDefinition: () => C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RecursiveType'; | ||
constructor(name: string, is: RecursiveType<C, A, O, I>['is'], validate: RecursiveType<C, A, O, I>['validate'], encode: RecursiveType<C, A, O, I>['encode'], runDefinition: () => C); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly type: C; | ||
runDefinition: () => C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'RecursiveType' | ||
constructor( | ||
name: string, | ||
is: RecursiveType<C, A, O, I>['is'], | ||
validate: RecursiveType<C, A, O, I>['validate'], | ||
encode: RecursiveType<C, A, O, I>['encode'], | ||
runDefinition: () => C | ||
) | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly type: C | ||
} | ||
@@ -580,3 +599,6 @@ /** | ||
*/ | ||
export declare const recursion: <A, O = A, I = unknown, C extends Type<A, O, I> = Type<A, O, I>>(name: string, definition: (self: C) => C) => RecursiveType<C, A, O, I>; | ||
export declare const recursion: <A, O = A, I = unknown, C extends Type<A, O, I> = Type<A, O, I>>( | ||
name: string, | ||
definition: (self: C) => C | ||
) => RecursiveType<C, A, O, I> | ||
/** | ||
@@ -586,8 +608,14 @@ * @since 1.0.0 | ||
export declare class ArrayType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ArrayType'; | ||
constructor(name: string, is: ArrayType<C, A, O, I>['is'], validate: ArrayType<C, A, O, I>['validate'], encode: ArrayType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ArrayType' | ||
constructor( | ||
name: string, | ||
is: ArrayType<C, A, O, I>['is'], | ||
validate: ArrayType<C, A, O, I>['validate'], | ||
encode: ArrayType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -597,4 +625,3 @@ /** | ||
*/ | ||
export interface ArrayC<C extends Mixed> extends ArrayType<C, Array<TypeOf<C>>, Array<OutputOf<C>>, unknown> { | ||
} | ||
export interface ArrayC<C extends Mixed> extends ArrayType<C, Array<TypeOf<C>>, Array<OutputOf<C>>, unknown> {} | ||
/** | ||
@@ -604,3 +631,3 @@ * @category Combinators | ||
*/ | ||
export declare const array: <C extends Mixed>(item: C, name?: string) => ArrayC<C>; | ||
export declare const array: <C extends Mixed>(item: C, name?: string) => ArrayC<C> | ||
/** | ||
@@ -610,8 +637,14 @@ * @since 1.0.0 | ||
export declare class InterfaceType<P, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly props: P; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'InterfaceType'; | ||
constructor(name: string, is: InterfaceType<P, A, O, I>['is'], validate: InterfaceType<P, A, O, I>['validate'], encode: InterfaceType<P, A, O, I>['encode'], props: P); | ||
readonly props: P | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'InterfaceType' | ||
constructor( | ||
name: string, | ||
is: InterfaceType<P, A, O, I>['is'], | ||
validate: InterfaceType<P, A, O, I>['validate'], | ||
encode: InterfaceType<P, A, O, I>['encode'], | ||
props: P | ||
) | ||
} | ||
@@ -622,3 +655,3 @@ /** | ||
export interface AnyProps { | ||
[key: string]: Any; | ||
[key: string]: Any | ||
} | ||
@@ -629,4 +662,4 @@ /** | ||
export declare type TypeOfProps<P extends AnyProps> = { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}; | ||
[K in keyof P]: TypeOf<P[K]> | ||
} | ||
/** | ||
@@ -636,4 +669,4 @@ * @since 1.0.0 | ||
export declare type OutputOfProps<P extends AnyProps> = { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}; | ||
[K in keyof P]: OutputOf<P[K]> | ||
} | ||
/** | ||
@@ -643,3 +676,3 @@ * @since 1.0.0 | ||
export interface Props { | ||
[key: string]: Mixed; | ||
[key: string]: Mixed | ||
} | ||
@@ -649,8 +682,13 @@ /** | ||
*/ | ||
export interface TypeC<P extends Props> extends InterfaceType<P, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, unknown> { | ||
} | ||
export interface TypeC<P extends Props> | ||
extends InterfaceType< | ||
P, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -660,3 +698,3 @@ * @category Combinators | ||
*/ | ||
export declare const type: <P extends Props>(props: P, name?: string) => TypeC<P>; | ||
export declare const type: <P extends Props>(props: P, name?: string) => TypeC<P> | ||
/** | ||
@@ -666,8 +704,14 @@ * @since 1.0.0 | ||
export declare class PartialType<P, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly props: P; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'PartialType'; | ||
constructor(name: string, is: PartialType<P, A, O, I>['is'], validate: PartialType<P, A, O, I>['validate'], encode: PartialType<P, A, O, I>['encode'], props: P); | ||
readonly props: P | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'PartialType' | ||
constructor( | ||
name: string, | ||
is: PartialType<P, A, O, I>['is'], | ||
validate: PartialType<P, A, O, I>['validate'], | ||
encode: PartialType<P, A, O, I>['encode'], | ||
props: P | ||
) | ||
} | ||
@@ -678,4 +722,4 @@ /** | ||
export declare type TypeOfPartialProps<P extends AnyProps> = { | ||
[K in keyof P]?: TypeOf<P[K]>; | ||
}; | ||
[K in keyof P]?: TypeOf<P[K]> | ||
} | ||
/** | ||
@@ -685,13 +729,18 @@ * @since 1.0.0 | ||
export declare type OutputOfPartialProps<P extends AnyProps> = { | ||
[K in keyof P]?: OutputOf<P[K]>; | ||
}; | ||
[K in keyof P]?: OutputOf<P[K]> | ||
} | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface PartialC<P extends Props> extends PartialType<P, { | ||
[K in keyof P]?: TypeOf<P[K]>; | ||
}, { | ||
[K in keyof P]?: OutputOf<P[K]>; | ||
}, unknown> { | ||
} | ||
export interface PartialC<P extends Props> | ||
extends PartialType< | ||
P, | ||
{ | ||
[K in keyof P]?: TypeOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]?: OutputOf<P[K]> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -701,3 +750,3 @@ * @category Combinators | ||
*/ | ||
export declare const partial: <P extends Props>(props: P, name?: string) => PartialC<P>; | ||
export declare const partial: <P extends Props>(props: P, name?: string) => PartialC<P> | ||
/** | ||
@@ -707,9 +756,16 @@ * @since 1.0.0 | ||
export declare class DictionaryType<D extends Any, C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly domain: D; | ||
readonly codomain: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'DictionaryType'; | ||
constructor(name: string, is: DictionaryType<D, C, A, O, I>['is'], validate: DictionaryType<D, C, A, O, I>['validate'], encode: DictionaryType<D, C, A, O, I>['encode'], domain: D, codomain: C); | ||
readonly domain: D | ||
readonly codomain: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'DictionaryType' | ||
constructor( | ||
name: string, | ||
is: DictionaryType<D, C, A, O, I>['is'], | ||
validate: DictionaryType<D, C, A, O, I>['validate'], | ||
encode: DictionaryType<D, C, A, O, I>['encode'], | ||
domain: D, | ||
codomain: C | ||
) | ||
} | ||
@@ -720,4 +776,4 @@ /** | ||
export declare type TypeOfDictionary<D extends Any, C extends Any> = { | ||
[K in TypeOf<D>]: TypeOf<C>; | ||
}; | ||
[K in TypeOf<D>]: TypeOf<C> | ||
} | ||
/** | ||
@@ -727,13 +783,19 @@ * @since 1.0.0 | ||
export declare type OutputOfDictionary<D extends Any, C extends Any> = { | ||
[K in OutputOf<D>]: OutputOf<C>; | ||
}; | ||
[K in OutputOf<D>]: OutputOf<C> | ||
} | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface RecordC<D extends Mixed, C extends Mixed> extends DictionaryType<D, C, { | ||
[K in TypeOf<D>]: TypeOf<C>; | ||
}, { | ||
[K in OutputOf<D>]: OutputOf<C>; | ||
}, unknown> { | ||
} | ||
export interface RecordC<D extends Mixed, C extends Mixed> | ||
extends DictionaryType< | ||
D, | ||
C, | ||
{ | ||
[K in TypeOf<D>]: TypeOf<C> | ||
}, | ||
{ | ||
[K in OutputOf<D>]: OutputOf<C> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -743,3 +805,3 @@ * @category Combinators | ||
*/ | ||
export declare function record<D extends Mixed, C extends Mixed>(domain: D, codomain: C, name?: string): RecordC<D, C>; | ||
export declare function record<D extends Mixed, C extends Mixed>(domain: D, codomain: C, name?: string): RecordC<D, C> | ||
/** | ||
@@ -749,8 +811,14 @@ * @since 1.0.0 | ||
export declare class UnionType<CS extends Array<Any>, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly types: CS; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnionType'; | ||
constructor(name: string, is: UnionType<CS, A, O, I>['is'], validate: UnionType<CS, A, O, I>['validate'], encode: UnionType<CS, A, O, I>['encode'], types: CS); | ||
readonly types: CS | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'UnionType' | ||
constructor( | ||
name: string, | ||
is: UnionType<CS, A, O, I>['is'], | ||
validate: UnionType<CS, A, O, I>['validate'], | ||
encode: UnionType<CS, A, O, I>['encode'], | ||
types: CS | ||
) | ||
} | ||
@@ -760,4 +828,4 @@ /** | ||
*/ | ||
export interface UnionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> extends UnionType<CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> { | ||
} | ||
export interface UnionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> | ||
extends UnionType<CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> {} | ||
/** | ||
@@ -767,3 +835,3 @@ * @category Combinators | ||
*/ | ||
export declare const union: <CS extends [Mixed, Mixed, ...Mixed[]]>(codecs: CS, name?: string) => UnionC<CS>; | ||
export declare const union: <CS extends [Mixed, Mixed, ...Mixed[]]>(codecs: CS, name?: string) => UnionC<CS> | ||
/** | ||
@@ -773,8 +841,14 @@ * @since 1.0.0 | ||
export declare class IntersectionType<CS extends Array<Any>, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly types: CS; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'IntersectionType'; | ||
constructor(name: string, is: IntersectionType<CS, A, O, I>['is'], validate: IntersectionType<CS, A, O, I>['validate'], encode: IntersectionType<CS, A, O, I>['encode'], types: CS); | ||
readonly types: CS | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'IntersectionType' | ||
constructor( | ||
name: string, | ||
is: IntersectionType<CS, A, O, I>['is'], | ||
validate: IntersectionType<CS, A, O, I>['validate'], | ||
encode: IntersectionType<CS, A, O, I>['encode'], | ||
types: CS | ||
) | ||
} | ||
@@ -784,20 +858,41 @@ /** | ||
*/ | ||
export interface IntersectionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> extends IntersectionType<CS, CS extends { | ||
length: 2; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> : CS extends { | ||
length: 3; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> : CS extends { | ||
length: 4; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> : CS extends { | ||
length: 5; | ||
} ? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> & TypeOf<CS[4]> : unknown, CS extends { | ||
length: 2; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> : CS extends { | ||
length: 3; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> : CS extends { | ||
length: 4; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> : CS extends { | ||
length: 5; | ||
} ? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> & OutputOf<CS[4]> : unknown, unknown> { | ||
} | ||
export interface IntersectionC<CS extends [Mixed, Mixed, ...Array<Mixed>]> | ||
extends IntersectionType< | ||
CS, | ||
CS extends { | ||
length: 2 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> | ||
: CS extends { | ||
length: 3 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> | ||
: CS extends { | ||
length: 4 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> | ||
: CS extends { | ||
length: 5 | ||
} | ||
? TypeOf<CS[0]> & TypeOf<CS[1]> & TypeOf<CS[2]> & TypeOf<CS[3]> & TypeOf<CS[4]> | ||
: unknown, | ||
CS extends { | ||
length: 2 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> | ||
: CS extends { | ||
length: 3 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> | ||
: CS extends { | ||
length: 4 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> | ||
: CS extends { | ||
length: 5 | ||
} | ||
? OutputOf<CS[0]> & OutputOf<CS[1]> & OutputOf<CS[2]> & OutputOf<CS[3]> & OutputOf<CS[4]> | ||
: unknown, | ||
unknown | ||
> {} | ||
/** | ||
@@ -807,6 +902,21 @@ * @category Combinators | ||
*/ | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed, E extends Mixed>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]>; | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>(codecs: [A, B, C, D], name?: string): IntersectionC<[A, B, C, D]>; | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed>(codecs: [A, B, C], name?: string): IntersectionC<[A, B, C]>; | ||
export declare function intersection<A extends Mixed, B extends Mixed>(codecs: [A, B], name?: string): IntersectionC<[A, B]>; | ||
export declare function intersection< | ||
A extends Mixed, | ||
B extends Mixed, | ||
C extends Mixed, | ||
D extends Mixed, | ||
E extends Mixed | ||
>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>( | ||
codecs: [A, B, C, D], | ||
name?: string | ||
): IntersectionC<[A, B, C, D]> | ||
export declare function intersection<A extends Mixed, B extends Mixed, C extends Mixed>( | ||
codecs: [A, B, C], | ||
name?: string | ||
): IntersectionC<[A, B, C]> | ||
export declare function intersection<A extends Mixed, B extends Mixed>( | ||
codecs: [A, B], | ||
name?: string | ||
): IntersectionC<[A, B]> | ||
/** | ||
@@ -816,8 +926,14 @@ * @since 1.0.0 | ||
export declare class TupleType<CS extends Array<Any>, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly types: CS; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'TupleType'; | ||
constructor(name: string, is: TupleType<CS, A, O, I>['is'], validate: TupleType<CS, A, O, I>['validate'], encode: TupleType<CS, A, O, I>['encode'], types: CS); | ||
readonly types: CS | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'TupleType' | ||
constructor( | ||
name: string, | ||
is: TupleType<CS, A, O, I>['is'], | ||
validate: TupleType<CS, A, O, I>['validate'], | ||
encode: TupleType<CS, A, O, I>['encode'], | ||
types: CS | ||
) | ||
} | ||
@@ -827,24 +943,49 @@ /** | ||
*/ | ||
export interface TupleC<CS extends [Mixed, ...Array<Mixed>]> extends TupleType<CS, CS extends { | ||
length: 1; | ||
} ? [TypeOf<CS[0]>] : CS extends { | ||
length: 2; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>] : CS extends { | ||
length: 3; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>] : CS extends { | ||
length: 4; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>] : CS extends { | ||
length: 5; | ||
} ? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>, TypeOf<CS[4]>] : unknown, CS extends { | ||
length: 1; | ||
} ? [OutputOf<CS[0]>] : CS extends { | ||
length: 2; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>] : CS extends { | ||
length: 3; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>] : CS extends { | ||
length: 4; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>] : CS extends { | ||
length: 5; | ||
} ? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>, OutputOf<CS[4]>] : unknown, unknown> { | ||
} | ||
export interface TupleC<CS extends [Mixed, ...Array<Mixed>]> | ||
extends TupleType< | ||
CS, | ||
CS extends { | ||
length: 1 | ||
} | ||
? [TypeOf<CS[0]>] | ||
: CS extends { | ||
length: 2 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>] | ||
: CS extends { | ||
length: 3 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>] | ||
: CS extends { | ||
length: 4 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>] | ||
: CS extends { | ||
length: 5 | ||
} | ||
? [TypeOf<CS[0]>, TypeOf<CS[1]>, TypeOf<CS[2]>, TypeOf<CS[3]>, TypeOf<CS[4]>] | ||
: unknown, | ||
CS extends { | ||
length: 1 | ||
} | ||
? [OutputOf<CS[0]>] | ||
: CS extends { | ||
length: 2 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>] | ||
: CS extends { | ||
length: 3 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>] | ||
: CS extends { | ||
length: 4 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>] | ||
: CS extends { | ||
length: 5 | ||
} | ||
? [OutputOf<CS[0]>, OutputOf<CS[1]>, OutputOf<CS[2]>, OutputOf<CS[3]>, OutputOf<CS[4]>] | ||
: unknown, | ||
unknown | ||
> {} | ||
/** | ||
@@ -854,7 +995,16 @@ * @category Combinators | ||
*/ | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed, E extends Mixed>(codecs: [A, B, C, D, E], name?: string): TupleC<[A, B, C, D, E]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>(codecs: [A, B, C, D], name?: string): TupleC<[A, B, C, D]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed>(codecs: [A, B, C], name?: string): TupleC<[A, B, C]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed>(codecs: [A, B], name?: string): TupleC<[A, B]>; | ||
export declare function tuple<A extends Mixed>(codecs: [A], name?: string): TupleC<[A]>; | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed, E extends Mixed>( | ||
codecs: [A, B, C, D, E], | ||
name?: string | ||
): TupleC<[A, B, C, D, E]> | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed, D extends Mixed>( | ||
codecs: [A, B, C, D], | ||
name?: string | ||
): TupleC<[A, B, C, D]> | ||
export declare function tuple<A extends Mixed, B extends Mixed, C extends Mixed>( | ||
codecs: [A, B, C], | ||
name?: string | ||
): TupleC<[A, B, C]> | ||
export declare function tuple<A extends Mixed, B extends Mixed>(codecs: [A, B], name?: string): TupleC<[A, B]> | ||
export declare function tuple<A extends Mixed>(codecs: [A], name?: string): TupleC<[A]> | ||
/** | ||
@@ -864,8 +1014,14 @@ * @since 1.0.0 | ||
export declare class ReadonlyType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyType'; | ||
constructor(name: string, is: ReadonlyType<C, A, O, I>['is'], validate: ReadonlyType<C, A, O, I>['validate'], encode: ReadonlyType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyType' | ||
constructor( | ||
name: string, | ||
is: ReadonlyType<C, A, O, I>['is'], | ||
validate: ReadonlyType<C, A, O, I>['validate'], | ||
encode: ReadonlyType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -875,4 +1031,4 @@ /** | ||
*/ | ||
export interface ReadonlyC<C extends Mixed> extends ReadonlyType<C, Readonly<TypeOf<C>>, Readonly<OutputOf<C>>, unknown> { | ||
} | ||
export interface ReadonlyC<C extends Mixed> | ||
extends ReadonlyType<C, Readonly<TypeOf<C>>, Readonly<OutputOf<C>>, unknown> {} | ||
/** | ||
@@ -882,3 +1038,3 @@ * @category Combinators | ||
*/ | ||
export declare const readonly: <C extends Mixed>(codec: C, name?: string) => ReadonlyC<C>; | ||
export declare const readonly: <C extends Mixed>(codec: C, name?: string) => ReadonlyC<C> | ||
/** | ||
@@ -888,8 +1044,14 @@ * @since 1.0.0 | ||
export declare class ReadonlyArrayType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyArrayType'; | ||
constructor(name: string, is: ReadonlyArrayType<C, A, O, I>['is'], validate: ReadonlyArrayType<C, A, O, I>['validate'], encode: ReadonlyArrayType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ReadonlyArrayType' | ||
constructor( | ||
name: string, | ||
is: ReadonlyArrayType<C, A, O, I>['is'], | ||
validate: ReadonlyArrayType<C, A, O, I>['validate'], | ||
encode: ReadonlyArrayType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -899,4 +1061,4 @@ /** | ||
*/ | ||
export interface ReadonlyArrayC<C extends Mixed> extends ReadonlyArrayType<C, ReadonlyArray<TypeOf<C>>, ReadonlyArray<OutputOf<C>>, unknown> { | ||
} | ||
export interface ReadonlyArrayC<C extends Mixed> | ||
extends ReadonlyArrayType<C, ReadonlyArray<TypeOf<C>>, ReadonlyArray<OutputOf<C>>, unknown> {} | ||
/** | ||
@@ -906,3 +1068,3 @@ * @category Combinators | ||
*/ | ||
export declare const readonlyArray: <C extends Mixed>(item: C, name?: string) => ReadonlyArrayC<C>; | ||
export declare const readonlyArray: <C extends Mixed>(item: C, name?: string) => ReadonlyArrayC<C> | ||
/** | ||
@@ -914,3 +1076,3 @@ * Strips additional properties | ||
*/ | ||
export declare const strict: <P extends Props>(props: P, name?: string | undefined) => ExactC<TypeC<P>>; | ||
export declare const strict: <P extends Props>(props: P, name?: string | undefined) => ExactC<TypeC<P>> | ||
/** | ||
@@ -921,5 +1083,18 @@ * @category deprecated | ||
*/ | ||
export declare class TaggedUnionType<Tag extends string, CS extends Array<Mixed>, A = any, O = A, I = unknown> extends UnionType<CS, A, O, I> { | ||
readonly tag: Tag; | ||
constructor(name: string, is: TaggedUnionType<Tag, CS, A, O, I>['is'], validate: TaggedUnionType<Tag, CS, A, O, I>['validate'], encode: TaggedUnionType<Tag, CS, A, O, I>['encode'], codecs: CS, tag: Tag); | ||
export declare class TaggedUnionType< | ||
Tag extends string, | ||
CS extends Array<Mixed>, | ||
A = any, | ||
O = A, | ||
I = unknown | ||
> extends UnionType<CS, A, O, I> { | ||
readonly tag: Tag | ||
constructor( | ||
name: string, | ||
is: TaggedUnionType<Tag, CS, A, O, I>['is'], | ||
validate: TaggedUnionType<Tag, CS, A, O, I>['validate'], | ||
encode: TaggedUnionType<Tag, CS, A, O, I>['encode'], | ||
codecs: CS, | ||
tag: Tag | ||
) | ||
} | ||
@@ -931,5 +1106,4 @@ /** | ||
*/ | ||
export interface TaggedUnionC<Tag extends string, CS extends [Mixed, Mixed, ...Array<Mixed>]>// tslint:disable-next-line: deprecation | ||
extends TaggedUnionType<Tag, CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> { | ||
} | ||
export interface TaggedUnionC<Tag extends string, CS extends [Mixed, Mixed, ...Array<Mixed>]> // tslint:disable-next-line: deprecation | ||
extends TaggedUnionType<Tag, CS, TypeOf<CS[number]>, OutputOf<CS[number]>, unknown> {} | ||
/** | ||
@@ -942,3 +1116,7 @@ * Use `union` instead | ||
*/ | ||
export declare const taggedUnion: <Tag extends string, CS extends [Mixed, Mixed, ...Mixed[]]>(tag: Tag, codecs: CS, name?: string) => TaggedUnionC<Tag, CS>; | ||
export declare const taggedUnion: <Tag extends string, CS extends [Mixed, Mixed, ...Mixed[]]>( | ||
tag: Tag, | ||
codecs: CS, | ||
name?: string | ||
) => TaggedUnionC<Tag, CS> | ||
/** | ||
@@ -948,8 +1126,14 @@ * @since 1.1.0 | ||
export declare class ExactType<C extends Any, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly type: C; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ExactType'; | ||
constructor(name: string, is: ExactType<C, A, O, I>['is'], validate: ExactType<C, A, O, I>['validate'], encode: ExactType<C, A, O, I>['encode'], type: C); | ||
readonly type: C | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ExactType' | ||
constructor( | ||
name: string, | ||
is: ExactType<C, A, O, I>['is'], | ||
validate: ExactType<C, A, O, I>['validate'], | ||
encode: ExactType<C, A, O, I>['encode'], | ||
type: C | ||
) | ||
} | ||
@@ -959,23 +1143,25 @@ /** | ||
*/ | ||
export interface HasPropsRefinement extends RefinementType<HasProps, any, any, any> { | ||
} | ||
export interface HasPropsRefinement extends RefinementType<HasProps, any, any, any> {} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export interface HasPropsReadonly extends ReadonlyType<HasProps, any, any, any> { | ||
} | ||
export interface HasPropsReadonly extends ReadonlyType<HasProps, any, any, any> {} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export interface HasPropsIntersection extends IntersectionType<Array<HasProps>, any, any, any> { | ||
} | ||
export interface HasPropsIntersection extends IntersectionType<Array<HasProps>, any, any, any> {} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export declare type HasProps = HasPropsRefinement | HasPropsReadonly | HasPropsIntersection | InterfaceType<any, any, any, any> | StrictType<any, any, any, any> | PartialType<any, any, any, any>; | ||
export declare type HasProps = | ||
| HasPropsRefinement | ||
| HasPropsReadonly | ||
| HasPropsIntersection | ||
| InterfaceType<any, any, any, any> | ||
| StrictType<any, any, any, any> | ||
| PartialType<any, any, any, any> | ||
/** | ||
* @since 1.5.3 | ||
*/ | ||
export interface ExactC<C extends HasProps> extends ExactType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> { | ||
} | ||
export interface ExactC<C extends HasProps> extends ExactType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> {} | ||
/** | ||
@@ -985,37 +1171,42 @@ * Strips additional properties | ||
*/ | ||
export declare const exact: <C extends HasProps>(codec: C, name?: string) => ExactC<C>; | ||
export { | ||
export declare const exact: <C extends HasProps>(codec: C, name?: string) => ExactC<C> | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
nullType as null | ||
} | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
undefinedType as undefined | ||
} | ||
export { | ||
/** | ||
* Use `UnknownArray` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
UnknownArray as Array | ||
} | ||
export { | ||
/** | ||
* Use `type` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
type as interface | ||
} | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
voidType as void | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
nullType as null }; | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
undefinedType as undefined }; | ||
export { | ||
/** | ||
* Use `UnknownArray` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
UnknownArray as Array }; | ||
export { | ||
/** | ||
* Use `type` instead | ||
* | ||
* @category deprecated | ||
* @deprecated | ||
* @since 1.0.0 | ||
*/ | ||
type as interface }; | ||
export { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
voidType as void }; | ||
/** | ||
* Use `unknown` instead | ||
@@ -1027,3 +1218,3 @@ * | ||
*/ | ||
export declare type mixed = unknown; | ||
export declare type mixed = unknown | ||
/** | ||
@@ -1034,3 +1225,3 @@ * @category deprecated | ||
*/ | ||
export declare const getValidationError: (value: unknown, context: Context) => ValidationError; | ||
export declare const getValidationError: (value: unknown, context: Context) => ValidationError | ||
/** | ||
@@ -1041,3 +1232,3 @@ * @category deprecated | ||
*/ | ||
export declare const getDefaultContext: (decoder: Decoder<any, any>) => Context; | ||
export declare const getDefaultContext: (decoder: Decoder<any, any>) => Context | ||
/** | ||
@@ -1049,7 +1240,7 @@ * @category deprecated | ||
export declare class NeverType extends Type<never> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NeverType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'NeverType' | ||
constructor() | ||
} | ||
@@ -1061,4 +1252,3 @@ /** | ||
*/ | ||
export interface NeverC extends NeverType { | ||
} | ||
export interface NeverC extends NeverType {} | ||
/** | ||
@@ -1069,3 +1259,3 @@ * @category deprecated | ||
*/ | ||
export declare const never: NeverC; | ||
export declare const never: NeverC | ||
/** | ||
@@ -1077,7 +1267,7 @@ * @category deprecated | ||
export declare class AnyType extends Type<any> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'AnyType' | ||
constructor() | ||
} | ||
@@ -1089,4 +1279,3 @@ /** | ||
*/ | ||
export interface AnyC extends AnyType { | ||
} | ||
export interface AnyC extends AnyType {} | ||
/** | ||
@@ -1099,3 +1288,3 @@ * Use `unknown` instead | ||
*/ | ||
export declare const any: AnyC; | ||
export declare const any: AnyC | ||
/** | ||
@@ -1108,3 +1297,3 @@ * Use `UnknownRecord` instead | ||
*/ | ||
export declare const Dictionary: UnknownRecordC; | ||
export declare const Dictionary: UnknownRecordC | ||
/** | ||
@@ -1116,7 +1305,7 @@ * @category deprecated | ||
export declare class ObjectType extends Type<object> { | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ObjectType'; | ||
constructor(); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'ObjectType' | ||
constructor() | ||
} | ||
@@ -1128,4 +1317,3 @@ /** | ||
*/ | ||
export interface ObjectC extends ObjectType { | ||
} | ||
export interface ObjectC extends ObjectType {} | ||
/** | ||
@@ -1138,3 +1326,3 @@ * Use `UnknownRecord` instead | ||
*/ | ||
export declare const object: ObjectC; | ||
export declare const object: ObjectC | ||
/** | ||
@@ -1147,4 +1335,3 @@ * Use `BrandC` instead | ||
*/ | ||
export interface RefinementC<C extends Any> extends RefinementType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> { | ||
} | ||
export interface RefinementC<C extends Any> extends RefinementType<C, TypeOf<C>, OutputOf<C>, InputOf<C>> {} | ||
/** | ||
@@ -1157,3 +1344,7 @@ * Use `brand` instead | ||
*/ | ||
export declare function refinement<C extends Any>(codec: C, predicate: Predicate<TypeOf<C>>, name?: string): RefinementC<C>; | ||
export declare function refinement<C extends Any>( | ||
codec: C, | ||
predicate: Predicate<TypeOf<C>>, | ||
name?: string | ||
): RefinementC<C> | ||
/** | ||
@@ -1166,3 +1357,3 @@ * Use `Int` instead | ||
*/ | ||
export declare const Integer: RefinementC<NumberC>; | ||
export declare const Integer: RefinementC<NumberC> | ||
/** | ||
@@ -1175,3 +1366,3 @@ * Use `record` instead | ||
*/ | ||
export declare const dictionary: typeof record; | ||
export declare const dictionary: typeof record | ||
/** | ||
@@ -1185,4 +1376,4 @@ * used in `intersection` as a workaround for #234 | ||
export declare type Compact<A> = { | ||
[K in keyof A]: A[K]; | ||
}; | ||
[K in keyof A]: A[K] | ||
} | ||
/** | ||
@@ -1194,8 +1385,14 @@ * @category deprecated | ||
export declare class StrictType<P, A = any, O = A, I = unknown> extends Type<A, O, I> { | ||
readonly props: P; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StrictType'; | ||
constructor(name: string, is: StrictType<P, A, O, I>['is'], validate: StrictType<P, A, O, I>['validate'], encode: StrictType<P, A, O, I>['encode'], props: P); | ||
readonly props: P | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
readonly _tag: 'StrictType' | ||
constructor( | ||
name: string, | ||
is: StrictType<P, A, O, I>['is'], | ||
validate: StrictType<P, A, O, I>['validate'], | ||
encode: StrictType<P, A, O, I>['encode'], | ||
props: P | ||
) | ||
} | ||
@@ -1207,9 +1404,13 @@ /** | ||
*/ | ||
export interface StrictC<P extends Props>// tslint:disable-next-line: deprecation | ||
extends StrictType<P, { | ||
[K in keyof P]: TypeOf<P[K]>; | ||
}, { | ||
[K in keyof P]: OutputOf<P[K]>; | ||
}, unknown> { | ||
} | ||
export interface StrictC<P extends Props> // tslint:disable-next-line: deprecation | ||
extends StrictType< | ||
P, | ||
{ | ||
[K in keyof P]: TypeOf<P[K]> | ||
}, | ||
{ | ||
[K in keyof P]: OutputOf<P[K]> | ||
}, | ||
unknown | ||
> {} | ||
/** | ||
@@ -1221,4 +1422,4 @@ * @category deprecated | ||
export declare type TaggedProps<Tag extends string> = { | ||
[K in Tag]: LiteralType<any>; | ||
}; | ||
[K in Tag]: LiteralType<any> | ||
} | ||
/** | ||
@@ -1229,4 +1430,3 @@ * @category deprecated | ||
*/ | ||
export interface TaggedRefinement<Tag extends string, A, O = A> extends RefinementType<Tagged<Tag>, A, O> { | ||
} | ||
export interface TaggedRefinement<Tag extends string, A, O = A> extends RefinementType<Tagged<Tag>, A, O> {} | ||
/** | ||
@@ -1237,4 +1437,3 @@ * @category deprecated | ||
*/ | ||
export interface TaggedUnion<Tag extends string, A, O = A> extends UnionType<Array<Tagged<Tag>>, A, O> { | ||
} | ||
export interface TaggedUnion<Tag extends string, A, O = A> extends UnionType<Array<Tagged<Tag>>, A, O> {} | ||
/** | ||
@@ -1245,3 +1444,18 @@ * @category deprecated | ||
*/ | ||
export declare type TaggedIntersectionArgument<Tag extends string> = [Tagged<Tag>] | [Tagged<Tag>, Mixed] | [Mixed, Tagged<Tag>] | [Tagged<Tag>, Mixed, Mixed] | [Mixed, Tagged<Tag>, Mixed] | [Mixed, Mixed, Tagged<Tag>] | [Tagged<Tag>, Mixed, Mixed, Mixed] | [Mixed, Tagged<Tag>, Mixed, Mixed] | [Mixed, Mixed, Tagged<Tag>, Mixed] | [Mixed, Mixed, Mixed, Tagged<Tag>] | [Tagged<Tag>, Mixed, Mixed, Mixed, Mixed] | [Mixed, Tagged<Tag>, Mixed, Mixed, Mixed] | [Mixed, Mixed, Tagged<Tag>, Mixed, Mixed] | [Mixed, Mixed, Mixed, Tagged<Tag>, Mixed] | [Mixed, Mixed, Mixed, Mixed, Tagged<Tag>]; | ||
export declare type TaggedIntersectionArgument<Tag extends string> = | ||
| [Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed] | ||
| [Mixed, Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed, Mixed] | ||
| [Mixed, Tagged<Tag>, Mixed] | ||
| [Mixed, Mixed, Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed, Mixed, Mixed] | ||
| [Mixed, Tagged<Tag>, Mixed, Mixed] | ||
| [Mixed, Mixed, Tagged<Tag>, Mixed] | ||
| [Mixed, Mixed, Mixed, Tagged<Tag>] | ||
| [Tagged<Tag>, Mixed, Mixed, Mixed, Mixed] | ||
| [Mixed, Tagged<Tag>, Mixed, Mixed, Mixed] | ||
| [Mixed, Mixed, Tagged<Tag>, Mixed, Mixed] | ||
| [Mixed, Mixed, Mixed, Tagged<Tag>, Mixed] | ||
| [Mixed, Mixed, Mixed, Mixed, Tagged<Tag>] | ||
/** | ||
@@ -1252,5 +1466,4 @@ * @category deprecated | ||
*/ | ||
export interface TaggedIntersection<Tag extends string, A, O = A>// tslint:disable-next-line: deprecation | ||
extends IntersectionType<TaggedIntersectionArgument<Tag>, A, O> { | ||
} | ||
export interface TaggedIntersection<Tag extends string, A, O = A> // tslint:disable-next-line: deprecation | ||
extends IntersectionType<TaggedIntersectionArgument<Tag>, A, O> {} | ||
/** | ||
@@ -1261,4 +1474,3 @@ * @category deprecated | ||
*/ | ||
export interface TaggedExact<Tag extends string, A, O = A> extends ExactType<Tagged<Tag>, A, O> { | ||
} | ||
export interface TaggedExact<Tag extends string, A, O = A> extends ExactType<Tagged<Tag>, A, O> {} | ||
/** | ||
@@ -1269,3 +1481,10 @@ * @category deprecated | ||
*/ | ||
export declare type Tagged<Tag extends string, A = any, O = A> = InterfaceType<TaggedProps<Tag>, A, O> | StrictType<TaggedProps<Tag>, A, O> | TaggedRefinement<Tag, A, O> | TaggedUnion<Tag, A, O> | TaggedIntersection<Tag, A, O> | TaggedExact<Tag, A, O> | RecursiveType<any, A, O>; | ||
export declare type Tagged<Tag extends string, A = any, O = A> = | ||
| InterfaceType<TaggedProps<Tag>, A, O> | ||
| StrictType<TaggedProps<Tag>, A, O> | ||
| TaggedRefinement<Tag, A, O> | ||
| TaggedUnion<Tag, A, O> | ||
| TaggedIntersection<Tag, A, O> | ||
| TaggedExact<Tag, A, O> | ||
| RecursiveType<any, A, O> | ||
/** | ||
@@ -1278,3 +1497,3 @@ * Drops the codec "kind" | ||
*/ | ||
export declare function clean<A, O = A, I = unknown>(codec: Type<A, O, I>): Type<A, O, I>; | ||
export declare function clean<A, O = A, I = unknown>(codec: Type<A, O, I>): Type<A, O, I> | ||
/** | ||
@@ -1285,5 +1504,7 @@ * @category deprecated | ||
*/ | ||
export declare type PropsOf<T extends { | ||
props: any; | ||
}> = T['props']; | ||
export declare type PropsOf< | ||
T extends { | ||
props: any | ||
} | ||
> = T['props'] | ||
/** | ||
@@ -1294,11 +1515,13 @@ * @category deprecated | ||
*/ | ||
export declare type Exact<T, X extends T> = T & { | ||
export declare type Exact<T, X extends T> = T & | ||
{ | ||
[K in ({ | ||
[K in keyof X]: K; | ||
} & { | ||
[K in keyof T]: never; | ||
} & { | ||
[key: string]: never; | ||
})[keyof X]]?: never; | ||
}; | ||
[K in keyof X]: K | ||
} & | ||
{ | ||
[K in keyof T]: never | ||
} & { | ||
[key: string]: never | ||
})[keyof X]]?: never | ||
} | ||
/** | ||
@@ -1311,4 +1534,25 @@ * Keeps the codec "kind" | ||
*/ | ||
export declare function alias<A, O, P, I>(codec: PartialType<P, A, O, I>): <AA extends Exact<A, AA>, OO extends Exact<O, OO> = O, PP extends Exact<P, PP> = P, II extends I = I>() => PartialType<PP, AA, OO, II>; | ||
export declare function alias<A, O, P, I>(codec: StrictType<P, A, O, I>): <AA extends Exact<A, AA>, OO extends Exact<O, OO> = O, PP extends Exact<P, PP> = P, II extends I = I>() => StrictType<PP, AA, OO, II>; | ||
export declare function alias<A, O, P, I>(codec: InterfaceType<P, A, O, I>): <AA extends Exact<A, AA>, OO extends Exact<O, OO> = O, PP extends Exact<P, PP> = P, II extends I = I>() => InterfaceType<PP, AA, OO, II>; | ||
export declare function alias<A, O, P, I>( | ||
codec: PartialType<P, A, O, I> | ||
): < | ||
AA extends Exact<A, AA>, | ||
OO extends Exact<O, OO> = O, | ||
PP extends Exact<P, PP> = P, | ||
II extends I = I | ||
>() => PartialType<PP, AA, OO, II> | ||
export declare function alias<A, O, P, I>( | ||
codec: StrictType<P, A, O, I> | ||
): < | ||
AA extends Exact<A, AA>, | ||
OO extends Exact<O, OO> = O, | ||
PP extends Exact<P, PP> = P, | ||
II extends I = I | ||
>() => StrictType<PP, AA, OO, II> | ||
export declare function alias<A, O, P, I>( | ||
codec: InterfaceType<P, A, O, I> | ||
): < | ||
AA extends Exact<A, AA>, | ||
OO extends Exact<O, OO> = O, | ||
PP extends Exact<P, PP> = P, | ||
II extends I = I | ||
>() => InterfaceType<PP, AA, OO, II> |
@@ -11,12 +11,12 @@ /** | ||
*/ | ||
import { Alt2C } from 'fp-ts/lib/Alt'; | ||
import { Applicative2C } from 'fp-ts/lib/Applicative'; | ||
import { Apply2C } from 'fp-ts/lib/Apply'; | ||
import { Bifunctor2 } from 'fp-ts/lib/Bifunctor'; | ||
import { Functor2C } from 'fp-ts/lib/Functor'; | ||
import { Kind2, URIS2 } from 'fp-ts/lib/HKT'; | ||
import { Monad2C } from 'fp-ts/lib/Monad'; | ||
import { MonadThrow2C } from 'fp-ts/lib/MonadThrow'; | ||
import { Literal } from './Schemable'; | ||
import { Lazy, Refinement } from 'fp-ts/lib/function'; | ||
import { Alt2C } from 'fp-ts/lib/Alt' | ||
import { Applicative2C } from 'fp-ts/lib/Applicative' | ||
import { Apply2C } from 'fp-ts/lib/Apply' | ||
import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' | ||
import { Functor2C } from 'fp-ts/lib/Functor' | ||
import { Kind2, URIS2 } from 'fp-ts/lib/HKT' | ||
import { Monad2C } from 'fp-ts/lib/Monad' | ||
import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' | ||
import { Literal } from './Schemable' | ||
import { Lazy, Refinement } from 'fp-ts/lib/function' | ||
/** | ||
@@ -27,3 +27,3 @@ * @category model | ||
export interface Kleisli<M extends URIS2, I, E, A> { | ||
readonly decode: (i: I) => Kind2<M, E, A>; | ||
readonly decode: (i: I) => Kind2<M, E, A> | ||
} | ||
@@ -34,3 +34,5 @@ /** | ||
*/ | ||
export declare function fromRefinement<M extends URIS2, E>(M: MonadThrow2C<M, E>): <I, A extends I>(refinement: Refinement<I, A>, onError: (i: I) => E) => Kleisli<M, I, E, A>; | ||
export declare function fromRefinement<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> | ||
): <I, A extends I>(refinement: Refinement<I, A>, onError: (i: I) => E) => Kleisli<M, I, E, A> | ||
/** | ||
@@ -40,3 +42,7 @@ * @category constructors | ||
*/ | ||
export declare function literal<M extends URIS2, E>(M: MonadThrow2C<M, E>): <I>(onError: (i: I, values: readonly [Literal, ...Array<Literal>]) => E) => <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kleisli<M, I, E, A[number]>; | ||
export declare function literal<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> | ||
): <I>( | ||
onError: (i: I, values: readonly [Literal, ...Array<Literal>]) => E | ||
) => <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kleisli<M, I, E, A[number]> | ||
/** | ||
@@ -46,3 +52,5 @@ * @category combinators | ||
*/ | ||
export declare function mapLeftWithInput<M extends URIS2>(M: Bifunctor2<M>): <I, E>(f: (i: I, e: E) => E) => <A>(decoder: Kleisli<M, I, E, A>) => Kleisli<M, I, E, A>; | ||
export declare function mapLeftWithInput<M extends URIS2>( | ||
M: Bifunctor2<M> | ||
): <I, E>(f: (i: I, e: E) => E) => <A>(decoder: Kleisli<M, I, E, A>) => Kleisli<M, I, E, A> | ||
/** | ||
@@ -52,3 +60,8 @@ * @category combinators | ||
*/ | ||
export declare function refine<M extends URIS2, E>(M: MonadThrow2C<M, E> & Bifunctor2<M>): <A, B extends A>(refinement: (a: A) => a is B, onError: (a: A) => E) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B>; | ||
export declare function refine<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> & Bifunctor2<M> | ||
): <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
onError: (a: A) => E | ||
) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B> | ||
/** | ||
@@ -58,3 +71,5 @@ * @category combinators | ||
*/ | ||
export declare function parse<M extends URIS2, E>(M: Monad2C<M, E>): <A, B>(decode: (a: A) => Kind2<M, E, B>) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B>; | ||
export declare function parse<M extends URIS2, E>( | ||
M: Monad2C<M, E> | ||
): <A, B>(decode: (a: A) => Kind2<M, E, B>) => <I>(from: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B> | ||
/** | ||
@@ -64,3 +79,5 @@ * @category combinators | ||
*/ | ||
export declare function nullable<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): <I>(onError: (i: I, e: E) => E) => <A>(or: Kleisli<M, I, E, A>) => Kleisli<M, null | I, E, null | A>; | ||
export declare function nullable<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): <I>(onError: (i: I, e: E) => E) => <A>(or: Kleisli<M, I, E, A>) => Kleisli<M, null | I, E, null | A> | ||
/** | ||
@@ -70,7 +87,18 @@ * @category combinators | ||
*/ | ||
export declare function fromType<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onPropertyError: (key: string, e: E) => E) => <P extends Record<string, Kleisli<M, any, E, any>>>(properties: P) => Kleisli<M, { | ||
[K in keyof P]: InputOf<M, P[K]>; | ||
}, E, { | ||
[K in keyof P]: TypeOf<M, P[K]>; | ||
}>; | ||
export declare function fromType<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onPropertyError: (key: string, e: E) => E | ||
) => <P extends Record<string, Kleisli<M, any, E, any>>>( | ||
properties: P | ||
) => Kleisli< | ||
M, | ||
{ | ||
[K in keyof P]: InputOf<M, P[K]> | ||
}, | ||
E, | ||
{ | ||
[K in keyof P]: TypeOf<M, P[K]> | ||
} | ||
> | ||
/** | ||
@@ -80,7 +108,22 @@ * @category combinators | ||
*/ | ||
export declare function fromPartial<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onPropertyError: (key: string, e: E) => E) => <P extends Record<string, Kleisli<M, any, E, any>>>(properties: P) => Kleisli<M, Partial<{ | ||
[K in keyof P]: InputOf<M, P[K]>; | ||
}>, E, Partial<{ | ||
[K in keyof P]: TypeOf<M, P[K]>; | ||
}>>; | ||
export declare function fromPartial<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onPropertyError: (key: string, e: E) => E | ||
) => <P extends Record<string, Kleisli<M, any, E, any>>>( | ||
properties: P | ||
) => Kleisli< | ||
M, | ||
Partial< | ||
{ | ||
[K in keyof P]: InputOf<M, P[K]> | ||
} | ||
>, | ||
E, | ||
Partial< | ||
{ | ||
[K in keyof P]: TypeOf<M, P[K]> | ||
} | ||
> | ||
> | ||
/** | ||
@@ -90,3 +133,5 @@ * @category combinators | ||
*/ | ||
export declare function fromArray<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onItemError: (index: number, e: E) => E) => <I, A>(item: Kleisli<M, I, E, A>) => Kleisli<M, Array<I>, E, Array<A>>; | ||
export declare function fromArray<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): (onItemError: (index: number, e: E) => E) => <I, A>(item: Kleisli<M, I, E, A>) => Kleisli<M, Array<I>, E, Array<A>> | ||
/** | ||
@@ -96,3 +141,7 @@ * @category combinators | ||
*/ | ||
export declare function fromRecord<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onKeyError: (key: string, e: E) => E) => <I, A>(codomain: Kleisli<M, I, E, A>) => Kleisli<M, Record<string, I>, E, Record<string, A>>; | ||
export declare function fromRecord<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onKeyError: (key: string, e: E) => E | ||
) => <I, A>(codomain: Kleisli<M, I, E, A>) => Kleisli<M, Record<string, I>, E, Record<string, A>> | ||
/** | ||
@@ -102,7 +151,18 @@ * @category combinators | ||
*/ | ||
export declare function fromTuple<M extends URIS2, E>(M: Applicative2C<M, E> & Bifunctor2<M>): (onIndexError: (index: number, e: E) => E) => <C extends ReadonlyArray<Kleisli<M, any, E, any>>>(...components: C) => Kleisli<M, { | ||
[K in keyof C]: InputOf<M, C[K]>; | ||
}, E, { | ||
[K in keyof C]: TypeOf<M, C[K]>; | ||
}>; | ||
export declare function fromTuple<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onIndexError: (index: number, e: E) => E | ||
) => <C extends ReadonlyArray<Kleisli<M, any, E, any>>>( | ||
...components: C | ||
) => Kleisli< | ||
M, | ||
{ | ||
[K in keyof C]: InputOf<M, C[K]> | ||
}, | ||
E, | ||
{ | ||
[K in keyof C]: TypeOf<M, C[K]> | ||
} | ||
> | ||
/** | ||
@@ -112,3 +172,9 @@ * @category combinators | ||
*/ | ||
export declare function union<M extends URIS2, E>(M: Alt2C<M, E> & Bifunctor2<M>): (onMemberError: (index: number, e: E) => E) => <MS extends readonly [Kleisli<M, any, E, any>, ...Array<Kleisli<M, any, E, any>>]>(...members: MS) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>>; | ||
export declare function union<M extends URIS2, E>( | ||
M: Alt2C<M, E> & Bifunctor2<M> | ||
): ( | ||
onMemberError: (index: number, e: E) => E | ||
) => <MS extends readonly [Kleisli<M, any, E, any>, ...Array<Kleisli<M, any, E, any>>]>( | ||
...members: MS | ||
) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>> | ||
/** | ||
@@ -118,3 +184,5 @@ * @category combinators | ||
*/ | ||
export declare function intersect<M extends URIS2, E>(M: Apply2C<M, E>): <IB, B>(right: Kleisli<M, IB, E, B>) => <IA, A>(left: Kleisli<M, IA, E, A>) => Kleisli<M, IA & IB, E, A & B>; | ||
export declare function intersect<M extends URIS2, E>( | ||
M: Apply2C<M, E> | ||
): <IB, B>(right: Kleisli<M, IB, E, B>) => <IA, A>(left: Kleisli<M, IA, E, A>) => Kleisli<M, IA & IB, E, A & B> | ||
/** | ||
@@ -124,3 +192,11 @@ * @category combinators | ||
*/ | ||
export declare function fromSum<M extends URIS2, E>(M: MonadThrow2C<M, E>): (onTagError: (tag: string, value: unknown, tags: ReadonlyArray<string>) => E) => <T extends string>(tag: T) => <MS extends Record<string, Kleisli<M, any, E, any>>>(members: MS) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>>; | ||
export declare function fromSum<M extends URIS2, E>( | ||
M: MonadThrow2C<M, E> | ||
): ( | ||
onTagError: (tag: string, value: unknown, tags: ReadonlyArray<string>) => E | ||
) => <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, Kleisli<M, any, E, any>>>( | ||
members: MS | ||
) => Kleisli<M, InputOf<M, MS[keyof MS]>, E, TypeOf<M, MS[keyof MS]>> | ||
/** | ||
@@ -130,3 +206,5 @@ * @category combinators | ||
*/ | ||
export declare function lazy<M extends URIS2>(M: Bifunctor2<M>): <E>(onError: (id: string, e: E) => E) => <I, A>(id: string, f: () => Kleisli<M, I, E, A>) => Kleisli<M, I, E, A>; | ||
export declare function lazy<M extends URIS2>( | ||
M: Bifunctor2<M> | ||
): <E>(onError: (id: string, e: E) => E) => <I, A>(id: string, f: () => Kleisli<M, I, E, A>) => Kleisli<M, I, E, A> | ||
/** | ||
@@ -136,3 +214,5 @@ * @category combinators | ||
*/ | ||
export declare function compose<M extends URIS2, E>(M: Monad2C<M, E>): <A, B>(ab: Kleisli<M, A, E, B>) => <I>(ia: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B>; | ||
export declare function compose<M extends URIS2, E>( | ||
M: Monad2C<M, E> | ||
): <A, B>(ab: Kleisli<M, A, E, B>) => <I>(ia: Kleisli<M, I, E, A>) => Kleisli<M, I, E, B> | ||
/** | ||
@@ -142,3 +222,3 @@ * @category combinators | ||
*/ | ||
export declare function id<M extends URIS2, E>(M: Applicative2C<M, E>): <A>() => Kleisli<M, A, E, A>; | ||
export declare function id<M extends URIS2, E>(M: Applicative2C<M, E>): <A>() => Kleisli<M, A, E, A> | ||
/** | ||
@@ -148,3 +228,5 @@ * @category combinators | ||
*/ | ||
export declare function map<F extends URIS2, E>(F: Functor2C<F, E>): <A, B>(f: (a: A) => B) => <I>(ia: Kleisli<F, I, E, A>) => Kleisli<F, I, E, B>; | ||
export declare function map<F extends URIS2, E>( | ||
F: Functor2C<F, E> | ||
): <A, B>(f: (a: A) => B) => <I>(ia: Kleisli<F, I, E, A>) => Kleisli<F, I, E, B> | ||
/** | ||
@@ -154,10 +236,12 @@ * @category combinators | ||
*/ | ||
export declare function alt<F extends URIS2, E>(A: Alt2C<F, E>): <I, A>(that: Lazy<Kleisli<F, I, E, A>>) => (me: Kleisli<F, I, E, A>) => Kleisli<F, I, E, A>; | ||
export declare function alt<F extends URIS2, E>( | ||
A: Alt2C<F, E> | ||
): <I, A>(that: Lazy<Kleisli<F, I, E, A>>) => (me: Kleisli<F, I, E, A>) => Kleisli<F, I, E, A> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type TypeOf<M extends URIS2, KD> = KD extends Kleisli<M, any, any, infer A> ? A : never; | ||
export declare type TypeOf<M extends URIS2, KD> = KD extends Kleisli<M, any, any, infer A> ? A : never | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type InputOf<M extends URIS2, KD> = KD extends Kleisli<M, infer I, any, any> ? I : never; | ||
export declare type InputOf<M extends URIS2, KD> = KD extends Kleisli<M, infer I, any, any> ? I : never |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.alt = exports.map = exports.id = exports.compose = exports.lazy = exports.fromSum = exports.intersect = exports.union = exports.fromTuple = exports.fromRecord = exports.fromArray = exports.fromPartial = exports.fromType = exports.nullable = exports.parse = exports.refine = exports.mapLeftWithInput = exports.literal = exports.fromRefinement = void 0; | ||
var E = require("fp-ts/lib/Either"); | ||
var G = require("./Guard"); | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
var G = __importStar(require("./Guard")); | ||
var Schemable_1 = require("./Schemable"); | ||
@@ -7,0 +26,0 @@ // ------------------------------------------------------------------------------------- |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import { Reporter } from './Reporter'; | ||
import { ValidationError } from '.'; | ||
import { Reporter } from './Reporter' | ||
import { ValidationError } from '.' | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare function failure(es: Array<ValidationError>): Array<string>; | ||
export declare function failure(es: Array<ValidationError>): Array<string> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare function success(): Array<string>; | ||
export declare function success(): Array<string> | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const PathReporter: Reporter<Array<string>>; | ||
export declare const PathReporter: Reporter<Array<string>> |
/** | ||
* @since 1.0.0 | ||
*/ | ||
import { Validation } from './index'; | ||
import { Validation } from './index' | ||
/** | ||
@@ -9,3 +9,3 @@ * @since 1.0.0 | ||
export interface Reporter<A> { | ||
report: (validation: Validation<any>) => A; | ||
report: (validation: Validation<any>) => A | ||
} |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT'; | ||
import { Schemable, Schemable1, Schemable2C } from './Schemable'; | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' | ||
import { Schemable, Schemable1, Schemable2C } from './Schemable' | ||
/** | ||
@@ -19,3 +19,3 @@ * @category model | ||
export interface Schema<A> { | ||
<S>(S: Schemable<S>): HKT<S, A>; | ||
<S>(S: Schemable<S>): HKT<S, A> | ||
} | ||
@@ -26,7 +26,7 @@ /** | ||
*/ | ||
export declare function make<A>(schema: Schema<A>): Schema<A>; | ||
export declare function make<A>(schema: Schema<A>): Schema<A> | ||
/** | ||
* @since 2.2.0 | ||
*/ | ||
export declare type TypeOf<S> = S extends Schema<infer A> ? A : never; | ||
export declare type TypeOf<S> = S extends Schema<infer A> ? A : never | ||
/** | ||
@@ -36,4 +36,4 @@ * @since 2.2.3 | ||
export declare const interpreter: { | ||
<S extends URIS2>(S: Schemable2C<S, unknown>): <A>(schema: Schema<A>) => Kind2<S, unknown, A>; | ||
<S extends URIS>(S: Schemable1<S>): <A>(schema: Schema<A>) => Kind<S, A>; | ||
}; | ||
<S extends URIS2>(S: Schemable2C<S, unknown>): <A>(schema: Schema<A>) => Kind2<S, unknown, A> | ||
<S extends URIS>(S: Schemable1<S>): <A>(schema: Schema<A>) => Kind<S, A> | ||
} |
@@ -11,7 +11,7 @@ /** | ||
*/ | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT'; | ||
import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' | ||
/** | ||
* @since 2.2.0 | ||
*/ | ||
export declare type Literal = string | number | boolean | null; | ||
export declare type Literal = string | number | boolean | null | ||
/** | ||
@@ -21,28 +21,46 @@ * @since 2.2.3 | ||
export interface Schemable<S> { | ||
readonly URI: S; | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => HKT<S, A[number]>; | ||
readonly string: HKT<S, string>; | ||
readonly number: HKT<S, number>; | ||
readonly boolean: HKT<S, boolean>; | ||
readonly nullable: <A>(or: HKT<S, A>) => HKT<S, null | A>; | ||
readonly type: <A>(properties: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, { | ||
[K in keyof A]: A[K]; | ||
}>; | ||
readonly partial: <A>(properties: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
readonly record: <A>(codomain: HKT<S, A>) => HKT<S, Record<string, A>>; | ||
readonly array: <A>(item: HKT<S, A>) => HKT<S, Array<A>>; | ||
readonly tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, A>; | ||
readonly intersect: <B>(right: HKT<S, B>) => <A>(left: HKT<S, A>) => HKT<S, A & B>; | ||
readonly sum: <T extends string>(tag: T) => <A>(members: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, A[keyof A]>; | ||
readonly lazy: <A>(id: string, f: () => HKT<S, A>) => HKT<S, A>; | ||
readonly URI: S | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => HKT<S, A[number]> | ||
readonly string: HKT<S, string> | ||
readonly number: HKT<S, number> | ||
readonly boolean: HKT<S, boolean> | ||
readonly nullable: <A>(or: HKT<S, A>) => HKT<S, null | A> | ||
readonly type: <A>( | ||
properties: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
properties: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT< | ||
S, | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
readonly record: <A>(codomain: HKT<S, A>) => HKT<S, Record<string, A>> | ||
readonly array: <A>(item: HKT<S, A>) => HKT<S, Array<A>> | ||
readonly tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT<S, A> | ||
readonly intersect: <B>(right: HKT<S, B>) => <A>(left: HKT<S, A>) => HKT<S, A & B> | ||
readonly sum: <T extends string>( | ||
tag: T | ||
) => <A>( | ||
members: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT<S, A[keyof A]> | ||
readonly lazy: <A>(id: string, f: () => HKT<S, A>) => HKT<S, A> | ||
} | ||
@@ -53,28 +71,46 @@ /** | ||
export interface Schemable1<S extends URIS> { | ||
readonly URI: S; | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind<S, A[number]>; | ||
readonly string: Kind<S, string>; | ||
readonly number: Kind<S, number>; | ||
readonly boolean: Kind<S, boolean>; | ||
readonly nullable: <A>(or: Kind<S, A>) => Kind<S, null | A>; | ||
readonly type: <A>(properties: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, { | ||
[K in keyof A]: A[K]; | ||
}>; | ||
readonly partial: <A>(properties: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
readonly record: <A>(codomain: Kind<S, A>) => Kind<S, Record<string, A>>; | ||
readonly array: <A>(item: Kind<S, A>) => Kind<S, Array<A>>; | ||
readonly tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, A>; | ||
readonly intersect: <B>(right: Kind<S, B>) => <A>(left: Kind<S, A>) => Kind<S, A & B>; | ||
readonly sum: <T extends string>(tag: T) => <A>(members: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, A[keyof A]>; | ||
readonly lazy: <A>(id: string, f: () => Kind<S, A>) => Kind<S, A>; | ||
readonly URI: S | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind<S, A[number]> | ||
readonly string: Kind<S, string> | ||
readonly number: Kind<S, number> | ||
readonly boolean: Kind<S, boolean> | ||
readonly nullable: <A>(or: Kind<S, A>) => Kind<S, null | A> | ||
readonly type: <A>( | ||
properties: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
properties: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind< | ||
S, | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
readonly record: <A>(codomain: Kind<S, A>) => Kind<S, Record<string, A>> | ||
readonly array: <A>(item: Kind<S, A>) => Kind<S, Array<A>> | ||
readonly tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind<S, A> | ||
readonly intersect: <B>(right: Kind<S, B>) => <A>(left: Kind<S, A>) => Kind<S, A & B> | ||
readonly sum: <T extends string>( | ||
tag: T | ||
) => <A>( | ||
members: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind<S, A[keyof A]> | ||
readonly lazy: <A>(id: string, f: () => Kind<S, A>) => Kind<S, A> | ||
} | ||
@@ -85,28 +121,48 @@ /** | ||
export interface Schemable2C<S extends URIS2, E> { | ||
readonly URI: S; | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind2<S, E, A[number]>; | ||
readonly string: Kind2<S, E, string>; | ||
readonly number: Kind2<S, E, number>; | ||
readonly boolean: Kind2<S, E, boolean>; | ||
readonly nullable: <A>(or: Kind2<S, E, A>) => Kind2<S, E, null | A>; | ||
readonly type: <A>(properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, { | ||
[K in keyof A]: A[K]; | ||
}>; | ||
readonly partial: <A>(properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, Partial<{ | ||
[K in keyof A]: A[K]; | ||
}>>; | ||
readonly record: <A>(codomain: Kind2<S, E, A>) => Kind2<S, E, Record<string, A>>; | ||
readonly array: <A>(item: Kind2<S, E, A>) => Kind2<S, E, Array<A>>; | ||
readonly tuple: <A extends ReadonlyArray<unknown>>(...components: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, A>; | ||
readonly intersect: <B>(right: Kind2<S, E, B>) => <A>(left: Kind2<S, E, A>) => Kind2<S, E, A & B>; | ||
readonly sum: <T extends string>(tag: T) => <A>(members: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, A[keyof A]>; | ||
readonly lazy: <A>(id: string, f: () => Kind2<S, E, A>) => Kind2<S, E, A>; | ||
readonly URI: S | ||
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind2<S, E, A[number]> | ||
readonly string: Kind2<S, E, string> | ||
readonly number: Kind2<S, E, number> | ||
readonly boolean: Kind2<S, E, boolean> | ||
readonly nullable: <A>(or: Kind2<S, E, A>) => Kind2<S, E, null | A> | ||
readonly type: <A>( | ||
properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2< | ||
S, | ||
E, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2< | ||
S, | ||
E, | ||
Partial< | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
> | ||
readonly record: <A>(codomain: Kind2<S, E, A>) => Kind2<S, E, Record<string, A>> | ||
readonly array: <A>(item: Kind2<S, E, A>) => Kind2<S, E, Array<A>> | ||
readonly tuple: <A extends ReadonlyArray<unknown>>( | ||
...components: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2<S, E, A> | ||
readonly intersect: <B>(right: Kind2<S, E, B>) => <A>(left: Kind2<S, E, A>) => Kind2<S, E, A & B> | ||
readonly sum: <T extends string>( | ||
tag: T | ||
) => <A>( | ||
members: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2<S, E, A[keyof A]> | ||
readonly lazy: <A>(id: string, f: () => Kind2<S, E, A>) => Kind2<S, E, A> | ||
} | ||
@@ -117,4 +173,4 @@ /** | ||
export interface WithUnknownContainers<S> { | ||
readonly UnknownArray: HKT<S, Array<unknown>>; | ||
readonly UnknownRecord: HKT<S, Record<string, unknown>>; | ||
readonly UnknownArray: HKT<S, Array<unknown>> | ||
readonly UnknownRecord: HKT<S, Record<string, unknown>> | ||
} | ||
@@ -125,4 +181,4 @@ /** | ||
export interface WithUnknownContainers1<S extends URIS> { | ||
readonly UnknownArray: Kind<S, Array<unknown>>; | ||
readonly UnknownRecord: Kind<S, Record<string, unknown>>; | ||
readonly UnknownArray: Kind<S, Array<unknown>> | ||
readonly UnknownRecord: Kind<S, Record<string, unknown>> | ||
} | ||
@@ -133,4 +189,4 @@ /** | ||
export interface WithUnknownContainers2C<S extends URIS2, E> { | ||
readonly UnknownArray: Kind2<S, E, Array<unknown>>; | ||
readonly UnknownRecord: Kind2<S, E, Record<string, unknown>>; | ||
readonly UnknownArray: Kind2<S, E, Array<unknown>> | ||
readonly UnknownRecord: Kind2<S, E, Record<string, unknown>> | ||
} | ||
@@ -141,5 +197,7 @@ /** | ||
export interface WithUnion<S> { | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>(...members: { | ||
[K in keyof A]: HKT<S, A[K]>; | ||
}) => HKT<S, A[number]>; | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>( | ||
...members: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT<S, A[number]> | ||
} | ||
@@ -150,5 +208,7 @@ /** | ||
export interface WithUnion1<S extends URIS> { | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>(...members: { | ||
[K in keyof A]: Kind<S, A[K]>; | ||
}) => Kind<S, A[number]>; | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>( | ||
...members: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind<S, A[number]> | ||
} | ||
@@ -159,5 +219,7 @@ /** | ||
export interface WithUnion2C<S extends URIS2, E> { | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>(...members: { | ||
[K in keyof A]: Kind2<S, E, A[K]>; | ||
}) => Kind2<S, E, A[number]>; | ||
readonly union: <A extends readonly [unknown, ...Array<unknown>]>( | ||
...members: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2<S, E, A[number]> | ||
} | ||
@@ -168,3 +230,3 @@ /** | ||
export interface WithRefine<S> { | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: HKT<S, A>) => HKT<S, B>; | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: HKT<S, A>) => HKT<S, B> | ||
} | ||
@@ -175,3 +237,3 @@ /** | ||
export interface WithRefine1<S extends URIS> { | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Kind<S, A>) => Kind<S, B>; | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Kind<S, A>) => Kind<S, B> | ||
} | ||
@@ -182,3 +244,6 @@ /** | ||
export interface WithRefine2C<S extends URIS2, E> { | ||
readonly refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Kind2<S, E, A>) => Kind2<S, E, B>; | ||
readonly refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => (from: Kind2<S, E, A>) => Kind2<S, E, B> | ||
} | ||
@@ -188,2 +253,2 @@ /** | ||
*/ | ||
export declare function memoize<A, B>(f: (a: A) => B): (a: A) => B; | ||
export declare function memoize<A, B>(f: (a: A) => B): (a: A) => B |
@@ -11,13 +11,13 @@ /** | ||
*/ | ||
import { Alt2 } from 'fp-ts/lib/Alt'; | ||
import { Category2 } from 'fp-ts/lib/Category'; | ||
import { Refinement } from 'fp-ts/lib/function'; | ||
import { Functor2 } from 'fp-ts/lib/Functor'; | ||
import * as TE from 'fp-ts/lib/TaskEither'; | ||
import * as DE from './DecodeError'; | ||
import * as D from './Decoder'; | ||
import * as FS from './FreeSemigroup'; | ||
import * as G from './Guard'; | ||
import * as K from './Kleisli'; | ||
import * as S from './Schemable'; | ||
import { Alt2 } from 'fp-ts/lib/Alt' | ||
import { Category2 } from 'fp-ts/lib/Category' | ||
import { Refinement } from 'fp-ts/lib/function' | ||
import { Functor2 } from 'fp-ts/lib/Functor' | ||
import * as TE from 'fp-ts/lib/TaskEither' | ||
import * as DE from './DecodeError' | ||
import * as D from './Decoder' | ||
import * as FS from './FreeSemigroup' | ||
import * as G from './Guard' | ||
import * as K from './Kleisli' | ||
import * as S from './Schemable' | ||
/** | ||
@@ -27,4 +27,3 @@ * @category model | ||
*/ | ||
export interface TaskDecoder<I, A> extends K.Kleisli<TE.URI, I, DecodeError, A> { | ||
} | ||
export interface TaskDecoder<I, A> extends K.Kleisli<TE.URI, I, DecodeError, A> {} | ||
/** | ||
@@ -34,3 +33,3 @@ * @category DecodeError | ||
*/ | ||
export declare type DecodeError = D.DecodeError; | ||
export declare type DecodeError = D.DecodeError | ||
/** | ||
@@ -40,3 +39,3 @@ * @category DecodeError | ||
*/ | ||
export declare const error: (actual: unknown, message: string) => DecodeError; | ||
export declare const error: (actual: unknown, message: string) => DecodeError | ||
/** | ||
@@ -46,3 +45,3 @@ * @category DecodeError | ||
*/ | ||
export declare const success: <A>(a: A) => TE.TaskEither<DecodeError, A>; | ||
export declare const success: <A>(a: A) => TE.TaskEither<DecodeError, A> | ||
/** | ||
@@ -52,3 +51,6 @@ * @category DecodeError | ||
*/ | ||
export declare const failure: <A = never>(actual: unknown, message: string) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, A>; | ||
export declare const failure: <A = never>( | ||
actual: unknown, | ||
message: string | ||
) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, A> | ||
/** | ||
@@ -58,3 +60,3 @@ * @category constructors | ||
*/ | ||
export declare const fromDecoder: <I, A>(decoder: D.Decoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const fromDecoder: <I, A>(decoder: D.Decoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -64,3 +66,6 @@ * @category constructors | ||
*/ | ||
export declare const fromRefinement: <I, A extends I>(refinement: Refinement<I, A>, expected: string) => TaskDecoder<I, A>; | ||
export declare const fromRefinement: <I, A extends I>( | ||
refinement: Refinement<I, A>, | ||
expected: string | ||
) => TaskDecoder<I, A> | ||
/** | ||
@@ -70,3 +75,3 @@ * @category constructors | ||
*/ | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => TaskDecoder<I, A>; | ||
export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => TaskDecoder<I, A> | ||
/** | ||
@@ -76,3 +81,5 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>(...values: A) => TaskDecoder<unknown, A[number]>; | ||
export declare const literal: <A extends readonly [S.Literal, ...Array<S.Literal>]>( | ||
...values: A | ||
) => TaskDecoder<unknown, A[number]> | ||
/** | ||
@@ -82,3 +89,3 @@ * @category primitives | ||
*/ | ||
export declare const string: TaskDecoder<unknown, string>; | ||
export declare const string: TaskDecoder<unknown, string> | ||
/** | ||
@@ -88,3 +95,3 @@ * @category primitives | ||
*/ | ||
export declare const number: TaskDecoder<unknown, number>; | ||
export declare const number: TaskDecoder<unknown, number> | ||
/** | ||
@@ -94,3 +101,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: TaskDecoder<unknown, boolean>; | ||
export declare const boolean: TaskDecoder<unknown, boolean> | ||
/** | ||
@@ -100,3 +107,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: TaskDecoder<unknown, Array<unknown>>; | ||
export declare const UnknownArray: TaskDecoder<unknown, Array<unknown>> | ||
/** | ||
@@ -106,3 +113,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: TaskDecoder<unknown, Record<string, unknown>>; | ||
export declare const UnknownRecord: TaskDecoder<unknown, Record<string, unknown>> | ||
/** | ||
@@ -112,3 +119,5 @@ * @category combinators | ||
*/ | ||
export declare const mapLeftWithInput: <I>(f: (input: I, e: DecodeError) => DecodeError) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const mapLeftWithInput: <I>( | ||
f: (input: I, e: DecodeError) => DecodeError | ||
) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -118,3 +127,5 @@ * @category combinators | ||
*/ | ||
export declare const withMessage: <I>(message: (input: I, e: DecodeError) => string) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const withMessage: <I>( | ||
message: (input: I, e: DecodeError) => string | ||
) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -124,3 +135,6 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const refine: <A, B extends A>( | ||
refinement: (a: A) => a is B, | ||
id: string | ||
) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -130,3 +144,5 @@ * @category combinators | ||
*/ | ||
export declare const parse: <A, B>(parser: (a: A) => TE.TaskEither<DecodeError, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const parse: <A, B>( | ||
parser: (a: A) => TE.TaskEither<DecodeError, B> | ||
) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -136,3 +152,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <I, A>(or: TaskDecoder<I, A>) => TaskDecoder<null | I, null | A>; | ||
export declare const nullable: <I, A>(or: TaskDecoder<I, A>) => TaskDecoder<null | I, null | A> | ||
/** | ||
@@ -142,3 +158,8 @@ * @category combinators | ||
*/ | ||
export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>(properties: P) => TaskDecoder<{ [K in keyof P]: K.InputOf<"TaskEither", P[K]>; }, { [K_1 in keyof P]: K.TypeOf<"TaskEither", P[K_1]>; }>; | ||
export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>( | ||
properties: P | ||
) => TaskDecoder< | ||
{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, | ||
{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } | ||
> | ||
/** | ||
@@ -148,3 +169,5 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, { [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>( | ||
properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -154,3 +177,8 @@ * @category combinators | ||
*/ | ||
export declare const fromPartial: <P extends Record<string, TaskDecoder<any, any>>>(properties: P) => TaskDecoder<Partial<{ [K in keyof P]: K.InputOf<"TaskEither", P[K]>; }>, Partial<{ [K_1 in keyof P]: K.TypeOf<"TaskEither", P[K_1]>; }>>; | ||
export declare const fromPartial: <P extends Record<string, TaskDecoder<any, any>>>( | ||
properties: P | ||
) => TaskDecoder< | ||
Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, | ||
Partial<{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> }> | ||
> | ||
/** | ||
@@ -160,3 +188,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -166,3 +196,3 @@ * @category combinators | ||
*/ | ||
export declare const fromArray: <I, A>(item: TaskDecoder<I, A>) => TaskDecoder<I[], A[]>; | ||
export declare const fromArray: <I, A>(item: TaskDecoder<I, A>) => TaskDecoder<I[], A[]> | ||
/** | ||
@@ -172,3 +202,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: TaskDecoder<unknown, A>) => TaskDecoder<unknown, A[]>; | ||
export declare const array: <A>(item: TaskDecoder<unknown, A>) => TaskDecoder<unknown, A[]> | ||
/** | ||
@@ -178,3 +208,5 @@ * @category combinators | ||
*/ | ||
export declare const fromRecord: <I, A>(codomain: TaskDecoder<I, A>) => TaskDecoder<Record<string, I>, Record<string, A>>; | ||
export declare const fromRecord: <I, A>( | ||
codomain: TaskDecoder<I, A> | ||
) => TaskDecoder<Record<string, I>, Record<string, A>> | ||
/** | ||
@@ -184,3 +216,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: TaskDecoder<unknown, A>) => TaskDecoder<unknown, Record<string, A>>; | ||
export declare const record: <A>(codomain: TaskDecoder<unknown, A>) => TaskDecoder<unknown, Record<string, A>> | ||
/** | ||
@@ -190,3 +222,8 @@ * @category combinators | ||
*/ | ||
export declare const fromTuple: <C extends readonly TaskDecoder<any, any>[]>(...components: C) => TaskDecoder<{ [K in keyof C]: K.InputOf<"TaskEither", C[K]>; }, { [K_1 in keyof C]: K.TypeOf<"TaskEither", C[K_1]>; }>; | ||
export declare const fromTuple: <C extends readonly TaskDecoder<any, any>[]>( | ||
...components: C | ||
) => TaskDecoder< | ||
{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, | ||
{ [K_1 in keyof C]: K.TypeOf<'TaskEither', C[K_1]> } | ||
> | ||
/** | ||
@@ -196,3 +233,5 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, A>; | ||
export declare const tuple: <A extends readonly unknown[]>( | ||
...components: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, A> | ||
/** | ||
@@ -202,3 +241,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <MS extends readonly [TaskDecoder<any, any>, ...Array<TaskDecoder<any, any>>]>(...members: MS) => TaskDecoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>>; | ||
export declare const union: <MS extends readonly [TaskDecoder<any, any>, ...Array<TaskDecoder<any, any>>]>( | ||
...members: MS | ||
) => TaskDecoder<InputOf<MS[keyof MS]>, TypeOf<MS[keyof MS]>> | ||
/** | ||
@@ -208,3 +249,5 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <IB, B>(right: TaskDecoder<IB, B>) => <IA, A>(left: TaskDecoder<IA, A>) => TaskDecoder<IA & IB, A & B>; | ||
export declare const intersect: <IB, B>( | ||
right: TaskDecoder<IB, B> | ||
) => <IA, A>(left: TaskDecoder<IA, A>) => TaskDecoder<IA & IB, A & B> | ||
/** | ||
@@ -214,3 +257,7 @@ * @category combinators | ||
*/ | ||
export declare const fromSum: <T extends string>(tag: T) => <MS extends Record<string, TaskDecoder<any, any>>>(members: MS) => TaskDecoder<K.InputOf<"TaskEither", MS[keyof MS]>, K.TypeOf<"TaskEither", MS[keyof MS]>>; | ||
export declare const fromSum: <T extends string>( | ||
tag: T | ||
) => <MS extends Record<string, TaskDecoder<any, any>>>( | ||
members: MS | ||
) => TaskDecoder<K.InputOf<'TaskEither', MS[keyof MS]>, K.TypeOf<'TaskEither', MS[keyof MS]>> | ||
/** | ||
@@ -220,3 +267,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(tag: T) => <A>(members: { [K in keyof A]: TaskDecoder<unknown, A[K]>; }) => TaskDecoder<unknown, A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
tag: T | ||
) => <A>(members: { [K in keyof A]: TaskDecoder<unknown, A[K]> }) => TaskDecoder<unknown, A[keyof A]> | ||
/** | ||
@@ -226,3 +275,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <I, A>(id: string, f: () => TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const lazy: <I, A>(id: string, f: () => TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -232,3 +281,3 @@ * @category Functor | ||
*/ | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -238,3 +287,3 @@ * @category Alt | ||
*/ | ||
export declare const alt: <I, A>(that: () => TaskDecoder<I, A>) => (me: TaskDecoder<I, A>) => TaskDecoder<I, A>; | ||
export declare const alt: <I, A>(that: () => TaskDecoder<I, A>) => (me: TaskDecoder<I, A>) => TaskDecoder<I, A> | ||
/** | ||
@@ -244,3 +293,3 @@ * @category Semigroupoid | ||
*/ | ||
export declare const compose: <A, B>(to: TaskDecoder<A, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>; | ||
export declare const compose: <A, B>(to: TaskDecoder<A, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B> | ||
/** | ||
@@ -250,3 +299,3 @@ * @category Category | ||
*/ | ||
export declare const id: <A>() => TaskDecoder<A, A>; | ||
export declare const id: <A>() => TaskDecoder<A, A> | ||
/** | ||
@@ -256,3 +305,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/TaskDecoder"; | ||
export declare const URI = 'io-ts/TaskDecoder' | ||
/** | ||
@@ -262,7 +311,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: TaskDecoder<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
readonly [URI]: TaskDecoder<E, A> | ||
} | ||
} | ||
@@ -273,3 +322,3 @@ /** | ||
*/ | ||
export declare const Functor: Functor2<URI>; | ||
export declare const Functor: Functor2<URI> | ||
/** | ||
@@ -279,3 +328,3 @@ * @category instances | ||
*/ | ||
export declare const Alt: Alt2<URI>; | ||
export declare const Alt: Alt2<URI> | ||
/** | ||
@@ -285,3 +334,3 @@ * @category instances | ||
*/ | ||
export declare const Category: Category2<URI>; | ||
export declare const Category: Category2<URI> | ||
/** | ||
@@ -291,3 +340,3 @@ * @category instances | ||
*/ | ||
export declare const Schemable: S.Schemable2C<URI, unknown>; | ||
export declare const Schemable: S.Schemable2C<URI, unknown> | ||
/** | ||
@@ -297,3 +346,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown>; | ||
export declare const WithUnknownContainers: S.WithUnknownContainers2C<URI, unknown> | ||
/** | ||
@@ -303,3 +352,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown>; | ||
export declare const WithUnion: S.WithUnion2C<URI, unknown> | ||
/** | ||
@@ -309,14 +358,14 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown>; | ||
export declare const WithRefine: S.WithRefine2C<URI, unknown> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare type TypeOf<KTD> = K.TypeOf<TE.URI, KTD>; | ||
export declare type TypeOf<KTD> = K.TypeOf<TE.URI, KTD> | ||
/** | ||
* @since 2.2.8 | ||
*/ | ||
export declare type InputOf<KTD> = K.InputOf<TE.URI, KTD>; | ||
export declare type InputOf<KTD> = K.InputOf<TE.URI, KTD> | ||
/** | ||
* @since 2.2.7 | ||
*/ | ||
export declare const draw: (e: DecodeError) => string; | ||
export declare const draw: (e: DecodeError) => string |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringify = exports.draw = exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.Category = exports.Alt = exports.Functor = exports.URI = exports.id = exports.compose = exports.alt = exports.map = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.union = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.fromType = exports.nullable = exports.parse = exports.refine = exports.withMessage = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromGuard = exports.fromRefinement = exports.fromDecoder = exports.failure = exports.success = exports.error = void 0; | ||
var E = require("fp-ts/lib/Either"); | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var T = require("fp-ts/lib/Task"); | ||
var TE = require("fp-ts/lib/TaskEither"); | ||
var DE = require("./DecodeError"); | ||
var D = require("./Decoder"); | ||
var FS = require("./FreeSemigroup"); | ||
var K = require("./Kleisli"); | ||
var T = __importStar(require("fp-ts/lib/Task")); | ||
var TE = __importStar(require("fp-ts/lib/TaskEither")); | ||
var DE = __importStar(require("./DecodeError")); | ||
var D = __importStar(require("./Decoder")); | ||
var FS = __importStar(require("./FreeSemigroup")); | ||
var K = __importStar(require("./Kleisli")); | ||
// ------------------------------------------------------------------------------------- | ||
@@ -13,0 +32,0 @@ // Kleisli config |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import { Reporter } from './Reporter'; | ||
import { Reporter } from './Reporter' | ||
/** | ||
@@ -12,2 +12,2 @@ * @category deprecated | ||
*/ | ||
export declare const ThrowReporter: Reporter<void>; | ||
export declare const ThrowReporter: Reporter<void> |
@@ -11,4 +11,4 @@ /** | ||
*/ | ||
import * as t from './index'; | ||
import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable'; | ||
import * as t from './index' | ||
import { Literal, Schemable1, WithUnion1, WithRefine1, WithUnknownContainers1 } from './Schemable' | ||
/** | ||
@@ -18,4 +18,3 @@ * @category model | ||
*/ | ||
export interface Type<A> extends t.Type<A, unknown, unknown> { | ||
} | ||
export interface Type<A> extends t.Type<A, unknown, unknown> {} | ||
/** | ||
@@ -25,3 +24,3 @@ * @category constructors | ||
*/ | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Type<A[number]>; | ||
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Type<A[number]> | ||
/** | ||
@@ -31,3 +30,3 @@ * @category primitives | ||
*/ | ||
export declare const string: Type<string>; | ||
export declare const string: Type<string> | ||
/** | ||
@@ -37,3 +36,3 @@ * @category primitives | ||
*/ | ||
export declare const number: Type<number>; | ||
export declare const number: Type<number> | ||
/** | ||
@@ -43,3 +42,3 @@ * @category primitives | ||
*/ | ||
export declare const boolean: Type<boolean>; | ||
export declare const boolean: Type<boolean> | ||
/** | ||
@@ -49,3 +48,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownArray: Type<Array<unknown>>; | ||
export declare const UnknownArray: Type<Array<unknown>> | ||
/** | ||
@@ -55,3 +54,3 @@ * @category primitives | ||
*/ | ||
export declare const UnknownRecord: Type<Record<string, unknown>>; | ||
export declare const UnknownRecord: Type<Record<string, unknown>> | ||
/** | ||
@@ -61,3 +60,3 @@ * @category combinators | ||
*/ | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Type<A>) => Type<B>; | ||
export declare const refine: <A, B extends A>(refinement: (a: A) => a is B, id: string) => (from: Type<A>) => Type<B> | ||
/** | ||
@@ -67,3 +66,3 @@ * @category combinators | ||
*/ | ||
export declare const nullable: <A>(or: Type<A>) => Type<A | null>; | ||
export declare const nullable: <A>(or: Type<A>) => Type<A | null> | ||
/** | ||
@@ -73,3 +72,3 @@ * @category combinators | ||
*/ | ||
export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]>; }) => Type<{ [K_1 in keyof A]: A[K_1]; }>; | ||
export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
@@ -79,3 +78,5 @@ * @category combinators | ||
*/ | ||
export declare const partial: <A>(properties: { [K in keyof A]: Type<A[K]>; }) => Type<Partial<{ [K_1 in keyof A]: A[K_1]; }>>; | ||
export declare const partial: <A>( | ||
properties: { [K in keyof A]: Type<A[K]> } | ||
) => Type<Partial<{ [K_1 in keyof A]: A[K_1] }>> | ||
/** | ||
@@ -85,3 +86,3 @@ * @category combinators | ||
*/ | ||
export declare const record: <A>(codomain: Type<A>) => Type<Record<string, A>>; | ||
export declare const record: <A>(codomain: Type<A>) => Type<Record<string, A>> | ||
/** | ||
@@ -91,3 +92,3 @@ * @category combinators | ||
*/ | ||
export declare const array: <A>(item: Type<A>) => Type<A[]>; | ||
export declare const array: <A>(item: Type<A>) => Type<A[]> | ||
/** | ||
@@ -97,3 +98,3 @@ * @category combinators | ||
*/ | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Type<A[K]>; }) => Type<A>; | ||
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Type<A[K]> }) => Type<A> | ||
/** | ||
@@ -103,3 +104,3 @@ * @category combinators | ||
*/ | ||
export declare const intersect: <B>(right: Type<B>) => <A>(left: Type<A>) => Type<A & B>; | ||
export declare const intersect: <B>(right: Type<B>) => <A>(left: Type<A>) => Type<A & B> | ||
/** | ||
@@ -109,3 +110,3 @@ * @category combinators | ||
*/ | ||
export declare const lazy: <A>(id: string, f: () => Type<A>) => Type<A>; | ||
export declare const lazy: <A>(id: string, f: () => Type<A>) => Type<A> | ||
/** | ||
@@ -115,3 +116,5 @@ * @category combinators | ||
*/ | ||
export declare const sum: <T extends string>(_tag: T) => <A>(members: { [K in keyof A]: Type<A[K]>; }) => Type<A[keyof A]>; | ||
export declare const sum: <T extends string>( | ||
_tag: T | ||
) => <A>(members: { [K in keyof A]: Type<A[K]> }) => Type<A[keyof A]> | ||
/** | ||
@@ -121,3 +124,5 @@ * @category combinators | ||
*/ | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>(...members: { [K in keyof A]: Type<A[K]>; }) => Type<A[number]>; | ||
export declare const union: <A extends readonly [unknown, ...unknown[]]>( | ||
...members: { [K in keyof A]: Type<A[K]> } | ||
) => Type<A[number]> | ||
/** | ||
@@ -127,3 +132,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "io-ts/Type"; | ||
export declare const URI = 'io-ts/Type' | ||
/** | ||
@@ -133,7 +138,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind<A> { | ||
readonly [URI]: Type<A>; | ||
} | ||
interface URItoKind<A> { | ||
readonly [URI]: Type<A> | ||
} | ||
} | ||
@@ -144,3 +149,3 @@ /** | ||
*/ | ||
export declare const Schemable: Schemable1<URI>; | ||
export declare const Schemable: Schemable1<URI> | ||
/** | ||
@@ -150,3 +155,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI>; | ||
export declare const WithUnknownContainers: WithUnknownContainers1<URI> | ||
/** | ||
@@ -156,3 +161,3 @@ * @category instances | ||
*/ | ||
export declare const WithUnion: WithUnion1<URI>; | ||
export declare const WithUnion: WithUnion1<URI> | ||
/** | ||
@@ -162,2 +167,2 @@ * @category instances | ||
*/ | ||
export declare const WithRefine: WithRefine1<URI>; | ||
export declare const WithRefine: WithRefine1<URI> |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -14,4 +33,4 @@ exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.union = exports.sum = exports.lazy = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; | ||
*/ | ||
var t = require("./index"); | ||
var E = require("fp-ts/lib/Either"); | ||
var t = __importStar(require("./index")); | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
@@ -18,0 +37,0 @@ // ------------------------------------------------------------------------------------- |
{ | ||
"name": "io-ts", | ||
"version": "2.2.9", | ||
"version": "2.2.10", | ||
"description": "TypeScript runtime type system for IO decoding/encoding", | ||
"files": [ | ||
"lib", | ||
"es6" | ||
], | ||
"main": "lib/index.js", | ||
@@ -13,18 +9,2 @@ "module": "es6/index.js", | ||
"sideEffects": false, | ||
"scripts": { | ||
"lint": "tslint -p tsconfig.tslint.json src/**/*.ts test/**/*.ts", | ||
"jest": "jest", | ||
"prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"", | ||
"fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples,exercises}/**/*.ts\"", | ||
"test": "npm run prettier && npm run lint && npm run dtslint && npm run jest && npm run docs", | ||
"clean": "rimraf lib/* es6/*", | ||
"build": "npm run clean && tsc && tsc -p tsconfig.es6.json && npm run import-path-rewrite", | ||
"prepublish": "npm run build", | ||
"perf": "ts-node perf/index", | ||
"dtslint": "dtslint dtslint", | ||
"mocha": "TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts", | ||
"doctoc": "doctoc README.md index.md Decoder.md Encoder.md Codec.md Eq.md Schema.md", | ||
"docs": "docs-ts", | ||
"import-path-rewrite": "import-path-rewrite" | ||
}, | ||
"repository": { | ||
@@ -44,23 +24,2 @@ "type": "git", | ||
}, | ||
"devDependencies": { | ||
"@types/benchmark": "1.0.31", | ||
"@types/jest": "25.2.1", | ||
"@types/node": "13.11.0", | ||
"benchmark": "2.1.4", | ||
"docs-ts": "^0.5.1", | ||
"doctoc": "1.4.0", | ||
"dtslint": "github:gcanti/dtslint", | ||
"fast-check": "^1.24.2", | ||
"fp-ts": "^2.7.0", | ||
"import-path-rewrite": "github:gcanti/import-path-rewrite", | ||
"jest": "25.2.7", | ||
"mocha": "7.1.1", | ||
"prettier": "2.0.2", | ||
"rimraf": "3.0.2", | ||
"ts-jest": "25.3.1", | ||
"ts-node": "8.8.2", | ||
"tslint": "6.1.1", | ||
"tslint-config-standard": "9.0.0", | ||
"typescript": "^3.9.3" | ||
}, | ||
"tags": [ | ||
@@ -80,2 +39,2 @@ "typescript", | ||
] | ||
} | ||
} |
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
437938
0
83
15609