Comparing version 2.2.14 to 2.2.15
@@ -17,2 +17,13 @@ # Changelog | ||
# 2.2.15 | ||
- **Experimental** | ||
- `Schemable` | ||
- (\*) add `readonly` combinator (@gcanti) | ||
- (\*) add `struct` combinator (@gcanti) | ||
- deprecate `type` in favour of `struct` (@gcanti) | ||
- deprecate `fromType` in favour of `fromStruct` (@gcanti) | ||
(\*) breaking change | ||
# 2.2.14 | ||
@@ -19,0 +30,0 @@ |
@@ -90,5 +90,5 @@ /** | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @since 2.2.15 | ||
*/ | ||
export declare function fromType<P extends Record<string, Codec<any, any, any>>>( | ||
export declare function fromStruct<P extends Record<string, Codec<any, any, any>>>( | ||
properties: P | ||
@@ -107,6 +107,14 @@ ): Codec< | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
export declare function type<P extends Record<string, Codec<unknown, any, any>>>( | ||
export declare const fromType: typeof fromStruct | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare function struct<P extends Record<string, Codec<unknown, any, any>>>( | ||
properties: P | ||
@@ -123,3 +131,11 @@ ): Codec< | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export declare const type: typeof struct | ||
/** | ||
* @category combinators | ||
* @since 2.2.8 | ||
@@ -126,0 +142,0 @@ */ |
@@ -112,14 +112,30 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export function fromStruct(properties) { | ||
return make(D.fromStruct(properties), E.struct(properties)); | ||
} | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
export function fromType(properties) { | ||
return make(D.fromType(properties), E.type(properties)); | ||
export var fromType = fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export function struct(properties) { | ||
return pipe(UnknownRecord, compose(fromStruct(properties))); | ||
} | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export function type(properties) { | ||
return pipe(UnknownRecord, compose(fromType(properties))); | ||
} | ||
export var type = struct; | ||
/** | ||
@@ -126,0 +142,0 @@ * @category combinators |
@@ -127,3 +127,13 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const fromStruct: <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]> }> | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
@@ -135,3 +145,13 @@ export declare const fromType: <P extends Record<string, Decoder<any, any>>>( | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>( | ||
properties: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
@@ -228,2 +248,7 @@ export declare const type: <A>( | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <I, A>(decoder: Decoder<I, A>) => Decoder<I, Readonly<A>> | ||
/** | ||
* @category Functor | ||
@@ -230,0 +255,0 @@ * @since 2.2.7 |
import * as E from 'fp-ts/es6/Either'; | ||
import { identity } from 'fp-ts/es6/function'; | ||
import { pipe } from 'fp-ts/es6/pipeable'; | ||
@@ -163,12 +164,28 @@ import * as DE from './DecodeError'; | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @since 2.2.15 | ||
*/ | ||
export var fromType = function (properties) { | ||
return K.fromType(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
export var fromStruct = function (properties) { | ||
return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
}; | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
export var fromType = fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var struct = function (properties) { return pipe(UnknownRecord, compose(fromStruct(properties))); }; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
export var type = function (properties) { return pipe(UnknownRecord, compose(fromType(properties))); }; | ||
export var type = struct; | ||
/** | ||
@@ -271,2 +288,7 @@ * @category combinators | ||
K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var readonly = identity; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -355,2 +377,3 @@ // non-pipeables | ||
type: type, | ||
struct: struct, | ||
partial: partial, | ||
@@ -362,3 +385,4 @@ record: record, | ||
sum: sum, | ||
lazy: lazy | ||
lazy: lazy, | ||
readonly: readonly | ||
}; | ||
@@ -365,0 +389,0 @@ /** |
@@ -27,5 +27,5 @@ /** | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.15 | ||
*/ | ||
export declare function type<P extends Record<string, Encoder<any, any>>>( | ||
export declare function struct<P extends Record<string, Encoder<any, any>>>( | ||
properties: P | ||
@@ -41,5 +41,13 @@ ): Encoder< | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export declare const type: typeof struct | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
*/ | ||
export declare function partial<P extends Record<string, Encoder<any, any>>>( | ||
@@ -46,0 +54,0 @@ properties: P |
@@ -17,5 +17,5 @@ import { memoize, intersect_ } from './Schemable'; | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.15 | ||
*/ | ||
export function type(properties) { | ||
export function struct(properties) { | ||
return { | ||
@@ -32,5 +32,13 @@ encode: function (a) { | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export var type = struct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
*/ | ||
export function partial(properties) { | ||
@@ -37,0 +45,0 @@ return { |
@@ -44,5 +44,5 @@ import * as E from 'fp-ts/es6/Eq' | ||
* @category combinators | ||
* @since 2.2.2 | ||
* @since 2.2.15 | ||
*/ | ||
export declare const type: <A>( | ||
export declare const struct: <A>( | ||
eqs: { | ||
@@ -57,5 +57,13 @@ [K in keyof A]: Eq<A[K]> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.2 | ||
* @deprecated | ||
*/ | ||
export declare const type: <A>(eqs: { [K in keyof A]: E.Eq<A[K]> }) => E.Eq<{ [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* @category combinators | ||
* @since 2.2.2 | ||
*/ | ||
export declare function partial<A>( | ||
@@ -113,2 +121,7 @@ properties: { | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <A>(eq: Eq<A>) => Eq<Readonly<A>> | ||
/** | ||
* @category instances | ||
@@ -115,0 +128,0 @@ * @since 2.2.8 |
@@ -13,2 +13,3 @@ /** | ||
import * as E from 'fp-ts/es6/Eq'; | ||
import { identity } from 'fp-ts/es6/function'; | ||
import * as R from 'fp-ts/es6/Record'; | ||
@@ -70,5 +71,13 @@ import { memoize } from './Schemable'; | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var struct = E.getStructEq; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.2 | ||
* @deprecated | ||
*/ | ||
export var type = E.getStructEq; | ||
export var type = struct; | ||
/** | ||
@@ -142,2 +151,7 @@ * @category combinators | ||
} | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var readonly = identity; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -158,2 +172,3 @@ // instances | ||
type: type, | ||
struct: struct, | ||
partial: partial, | ||
@@ -165,3 +180,4 @@ record: record, | ||
sum: sum, | ||
lazy: function (_, f) { return lazy(f); } | ||
lazy: function (_, f) { return lazy(f); }, | ||
readonly: readonly | ||
}; | ||
@@ -168,0 +184,0 @@ /** |
@@ -74,3 +74,13 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>( | ||
properties: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.0 | ||
* @deprecated | ||
*/ | ||
@@ -130,2 +140,7 @@ export declare const type: <A>( | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <I, A extends I>(guard: Guard<I, A>) => Guard<I, Readonly<A>> | ||
/** | ||
* @category combinators | ||
* @since 2.2.8 | ||
@@ -132,0 +147,0 @@ */ |
@@ -0,1 +1,12 @@ | ||
/** | ||
* **This module is experimental** | ||
* | ||
* Experimental features are published in order to get early feedback from the community, see these tracking | ||
* [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. | ||
* | ||
* A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
import { identity } from 'fp-ts/es6/function'; | ||
import { pipe } from 'fp-ts/es6/pipeable'; | ||
@@ -78,5 +89,5 @@ import { memoize } from './Schemable'; | ||
* @category combinators | ||
* @since 2.2.0 | ||
* @since 2.2.15 | ||
*/ | ||
export var type = function (properties) { | ||
export var struct = function (properties) { | ||
return pipe(UnknownRecord, refine(function (r) { | ||
@@ -92,5 +103,13 @@ for (var k in properties) { | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.0 | ||
* @deprecated | ||
*/ | ||
export var type = struct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.0 | ||
*/ | ||
export var partial = function (properties) { | ||
@@ -186,2 +205,7 @@ return pipe(UnknownRecord, refine(function (r) { | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var readonly = identity; | ||
/** | ||
* @category combinators | ||
* @since 2.2.8 | ||
@@ -233,2 +257,3 @@ */ | ||
type: type, | ||
struct: struct, | ||
partial: partial, | ||
@@ -240,3 +265,4 @@ record: record, | ||
sum: sum, | ||
lazy: function (_, f) { return lazy(f); } | ||
lazy: function (_, f) { return lazy(f); }, | ||
readonly: readonly | ||
}; | ||
@@ -243,0 +269,0 @@ /** |
@@ -77,5 +77,5 @@ /** | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @since 2.2.15 | ||
*/ | ||
export declare function fromType<M extends URIS2, E>( | ||
export declare function fromStruct<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
@@ -97,5 +97,13 @@ ): ( | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
export declare const fromType: typeof fromStruct | ||
/** | ||
* @category combinators | ||
* @since 2.2.7 | ||
*/ | ||
export declare function fromPartial<M extends URIS2, E>( | ||
@@ -102,0 +110,0 @@ M: Applicative2C<M, E> & Bifunctor2<M> |
@@ -72,5 +72,5 @@ import * as E from 'fp-ts/es6/Either'; | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @since 2.2.15 | ||
*/ | ||
export function fromType(M) { | ||
export function fromStruct(M) { | ||
var traverse = traverseRecordWithIndex(M); | ||
@@ -86,5 +86,13 @@ return function (onPropertyError) { return function (properties) { return ({ | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
export var fromType = fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.7 | ||
*/ | ||
export function fromPartial(M) { | ||
@@ -91,0 +99,0 @@ var traverse = traverseRecordWithIndex(M); |
@@ -27,2 +27,3 @@ /** | ||
readonly nullable: <A>(or: HKT<S, A>) => HKT<S, null | A> | ||
/** @deprecated */ | ||
readonly type: <A>( | ||
@@ -38,2 +39,12 @@ properties: { | ||
> | ||
readonly struct: <A>( | ||
properties: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
@@ -67,2 +78,3 @@ properties: { | ||
readonly lazy: <A>(id: string, f: () => HKT<S, A>) => HKT<S, A> | ||
readonly readonly: <A>(sa: HKT<S, A>) => HKT<S, Readonly<A>> | ||
} | ||
@@ -79,2 +91,3 @@ /** | ||
readonly nullable: <A>(or: Kind<S, A>) => Kind<S, null | A> | ||
/** @deprecated */ | ||
readonly type: <A>( | ||
@@ -90,2 +103,12 @@ properties: { | ||
> | ||
readonly struct: <A>( | ||
properties: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
@@ -119,2 +142,3 @@ properties: { | ||
readonly lazy: <A>(id: string, f: () => Kind<S, A>) => Kind<S, A> | ||
readonly readonly: <A>(sa: Kind<S, A>) => Kind<S, Readonly<A>> | ||
} | ||
@@ -131,2 +155,3 @@ /** | ||
readonly nullable: <A>(or: Kind2<S, E, A>) => Kind2<S, E, null | A> | ||
/** @deprecated */ | ||
readonly type: <A>( | ||
@@ -143,2 +168,13 @@ properties: { | ||
> | ||
readonly struct: <A>( | ||
properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2< | ||
S, | ||
E, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
@@ -173,2 +209,3 @@ properties: { | ||
readonly lazy: <A>(id: string, f: () => Kind2<S, E, A>) => Kind2<S, E, A> | ||
readonly readonly: <A>(sa: Kind2<S, E, A>) => Kind2<S, E, Readonly<A>> | ||
} | ||
@@ -175,0 +212,0 @@ /** |
@@ -136,3 +136,16 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const fromStruct: <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]> } | ||
> | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
@@ -147,3 +160,13 @@ export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>( | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>( | ||
properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
@@ -245,2 +268,7 @@ export declare const type: <A>( | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <I, A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, Readonly<A>> | ||
/** | ||
* @category Functor | ||
@@ -247,0 +275,0 @@ * @since 2.2.7 |
import * as E from 'fp-ts/es6/Either'; | ||
import { identity } from 'fp-ts/es6/function'; | ||
import { pipe } from 'fp-ts/es6/pipeable'; | ||
@@ -156,12 +157,28 @@ import * as T from 'fp-ts/es6/Task'; | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @since 2.2.15 | ||
*/ | ||
export var fromType = function (properties) { | ||
return K.fromType(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
export var fromStruct = function (properties) { | ||
return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
}; | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
export var fromType = fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var struct = function (properties) { return pipe(UnknownRecord, compose(fromStruct(properties))); }; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
export var type = function (properties) { return pipe(UnknownRecord, compose(fromType(properties))); }; | ||
export var type = struct; | ||
/** | ||
@@ -266,2 +283,7 @@ * @category combinators | ||
K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var readonly = identity; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -350,2 +372,3 @@ // non-pipeables | ||
type: type, | ||
struct: struct, | ||
partial: partial, | ||
@@ -357,3 +380,4 @@ record: record, | ||
sum: sum, | ||
lazy: lazy | ||
lazy: lazy, | ||
readonly: readonly | ||
}; | ||
@@ -360,0 +384,0 @@ /** |
@@ -51,3 +51,11 @@ import { Refinement } from 'fp-ts/es6/function' | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
@@ -89,2 +97,7 @@ export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K_1 in keyof A]: A[K_1] }> | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <A>(type: Type<A>) => Type<Readonly<A>> | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
@@ -91,0 +104,0 @@ */ |
@@ -12,2 +12,3 @@ /** | ||
import * as E from 'fp-ts/es6/Either'; | ||
import { identity } from 'fp-ts/es6/function'; | ||
import { pipe } from 'fp-ts/es6/pipeable'; | ||
@@ -77,11 +78,19 @@ import * as t from './index'; | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.15 | ||
*/ | ||
export var type = function (properties) { | ||
export var struct = function (properties) { | ||
return t.type(properties); | ||
}; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export var type = struct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
*/ | ||
export var partial = function (properties) { | ||
@@ -123,2 +132,7 @@ return t.partial(properties); | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export var readonly = identity; | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
@@ -158,2 +172,3 @@ */ | ||
type: type, | ||
struct: struct, | ||
partial: partial, | ||
@@ -165,3 +180,4 @@ record: record, | ||
sum: sum, | ||
lazy: lazy | ||
lazy: lazy, | ||
readonly: readonly | ||
}; | ||
@@ -168,0 +184,0 @@ /** |
@@ -90,5 +90,5 @@ /** | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @since 2.2.15 | ||
*/ | ||
export declare function fromType<P extends Record<string, Codec<any, any, any>>>( | ||
export declare function fromStruct<P extends Record<string, Codec<any, any, any>>>( | ||
properties: P | ||
@@ -107,6 +107,14 @@ ): Codec< | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
export declare function type<P extends Record<string, Codec<unknown, any, any>>>( | ||
export declare const fromType: typeof fromStruct | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare function struct<P extends Record<string, Codec<unknown, any, any>>>( | ||
properties: P | ||
@@ -123,3 +131,11 @@ ): Codec< | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export declare const type: typeof struct | ||
/** | ||
* @category combinators | ||
* @since 2.2.8 | ||
@@ -126,0 +142,0 @@ */ |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
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.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.refine = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromDecoder = exports.make = void 0; | ||
/** | ||
@@ -141,16 +141,32 @@ * **This module is experimental** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
function fromStruct(properties) { | ||
return make(D.fromStruct(properties), E.struct(properties)); | ||
} | ||
exports.fromStruct = fromStruct; | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
function fromType(properties) { | ||
return make(D.fromType(properties), E.type(properties)); | ||
exports.fromType = fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
function struct(properties) { | ||
return pipeable_1.pipe(exports.UnknownRecord, exports.compose(fromStruct(properties))); | ||
} | ||
exports.fromType = fromType; | ||
exports.struct = struct; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
function type(properties) { | ||
return pipeable_1.pipe(exports.UnknownRecord, exports.compose(fromType(properties))); | ||
} | ||
exports.type = type; | ||
exports.type = struct; | ||
/** | ||
@@ -157,0 +173,0 @@ * @category combinators |
@@ -127,3 +127,13 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const fromStruct: <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]> }> | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
@@ -135,3 +145,13 @@ export declare const fromType: <P extends Record<string, Decoder<any, any>>>( | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>( | ||
properties: { [K in keyof A]: Decoder<unknown, A[K]> } | ||
) => Decoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
@@ -228,2 +248,7 @@ export declare const type: <A>( | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <I, A>(decoder: Decoder<I, A>) => Decoder<I, Readonly<A>> | ||
/** | ||
* @category Functor | ||
@@ -230,0 +255,0 @@ * @since 2.2.7 |
@@ -22,4 +22,5 @@ "use strict"; | ||
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; | ||
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.readonly = 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.struct = exports.fromType = exports.fromStruct = 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 = __importStar(require("fp-ts/lib/Either")); | ||
var function_1 = require("fp-ts/lib/function"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
@@ -193,14 +194,30 @@ var DE = __importStar(require("./DecodeError")); | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @since 2.2.15 | ||
*/ | ||
var fromType = function (properties) { | ||
return K.fromType(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
var fromStruct = function (properties) { | ||
return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
}; | ||
exports.fromType = fromType; | ||
exports.fromStruct = fromStruct; | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
exports.fromType = exports.fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
var struct = function (properties) { return pipeable_1.pipe(exports.UnknownRecord, exports.compose(exports.fromStruct(properties))); }; | ||
exports.struct = struct; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
var type = function (properties) { return pipeable_1.pipe(exports.UnknownRecord, exports.compose(exports.fromType(properties))); }; | ||
exports.type = type; | ||
exports.type = exports.struct; | ||
/** | ||
@@ -313,2 +330,7 @@ * @category combinators | ||
K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
exports.readonly = function_1.identity; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -397,2 +419,3 @@ // non-pipeables | ||
type: exports.type, | ||
struct: exports.struct, | ||
partial: exports.partial, | ||
@@ -404,3 +427,4 @@ record: exports.record, | ||
sum: exports.sum, | ||
lazy: exports.lazy | ||
lazy: exports.lazy, | ||
readonly: exports.readonly | ||
}; | ||
@@ -407,0 +431,0 @@ /** |
@@ -27,5 +27,5 @@ /** | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.15 | ||
*/ | ||
export declare function type<P extends Record<string, Encoder<any, any>>>( | ||
export declare function struct<P extends Record<string, Encoder<any, any>>>( | ||
properties: P | ||
@@ -41,5 +41,13 @@ ): Encoder< | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
export declare const type: typeof struct | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
*/ | ||
export declare function partial<P extends Record<string, Encoder<any, any>>>( | ||
@@ -46,0 +54,0 @@ properties: P |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Category = exports.Contravariant = exports.URI = exports.id = exports.compose = exports.contramap = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.nullable = void 0; | ||
exports.Category = exports.Contravariant = exports.URI = exports.id = exports.compose = exports.contramap = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = void 0; | ||
var Schemable_1 = require("./Schemable"); | ||
@@ -21,5 +21,5 @@ var function_1 = require("fp-ts/lib/function"); | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.15 | ||
*/ | ||
function type(properties) { | ||
function struct(properties) { | ||
return { | ||
@@ -35,7 +35,15 @@ encode: function (a) { | ||
} | ||
exports.type = type; | ||
exports.struct = struct; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
exports.type = struct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
*/ | ||
function partial(properties) { | ||
@@ -42,0 +50,0 @@ return { |
@@ -44,5 +44,5 @@ import * as E from 'fp-ts/lib/Eq' | ||
* @category combinators | ||
* @since 2.2.2 | ||
* @since 2.2.15 | ||
*/ | ||
export declare const type: <A>( | ||
export declare const struct: <A>( | ||
eqs: { | ||
@@ -57,5 +57,13 @@ [K in keyof A]: Eq<A[K]> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.2 | ||
* @deprecated | ||
*/ | ||
export declare const type: <A>(eqs: { [K in keyof A]: E.Eq<A[K]> }) => E.Eq<{ [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* @category combinators | ||
* @since 2.2.2 | ||
*/ | ||
export declare function partial<A>( | ||
@@ -113,2 +121,7 @@ properties: { | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <A>(eq: Eq<A>) => Eq<Readonly<A>> | ||
/** | ||
* @category instances | ||
@@ -115,0 +128,0 @@ * @since 2.2.8 |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
exports.WithRefine = exports.WithUnknownContainers = exports.Schemable = exports.readonly = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = void 0; | ||
/** | ||
@@ -36,2 +36,3 @@ * **This module is experimental** | ||
var E = __importStar(require("fp-ts/lib/Eq")); | ||
var function_1 = require("fp-ts/lib/function"); | ||
var R = __importStar(require("fp-ts/lib/Record")); | ||
@@ -94,5 +95,13 @@ var Schemable_1 = require("./Schemable"); | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
exports.struct = E.getStructEq; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.2 | ||
* @deprecated | ||
*/ | ||
exports.type = E.getStructEq; | ||
exports.type = exports.struct; | ||
/** | ||
@@ -170,2 +179,7 @@ * @category combinators | ||
exports.lazy = lazy; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
exports.readonly = function_1.identity; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -186,2 +200,3 @@ // instances | ||
type: exports.type, | ||
struct: exports.struct, | ||
partial: partial, | ||
@@ -193,3 +208,4 @@ record: exports.record, | ||
sum: sum, | ||
lazy: function (_, f) { return lazy(f); } | ||
lazy: function (_, f) { return lazy(f); }, | ||
readonly: exports.readonly | ||
}; | ||
@@ -196,0 +212,0 @@ /** |
@@ -74,3 +74,13 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>( | ||
properties: { [K in keyof A]: Guard<unknown, A[K]> } | ||
) => Guard<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.0 | ||
* @deprecated | ||
*/ | ||
@@ -130,2 +140,7 @@ export declare const type: <A>( | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <I, A extends I>(guard: Guard<I, A>) => Guard<I, Readonly<A>> | ||
/** | ||
* @category combinators | ||
* @since 2.2.8 | ||
@@ -132,0 +147,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.id = exports.compose = exports.zero = exports.alt = exports.lazy = exports.sum = exports.union = exports.intersect = exports.tuple = exports.record = exports.array = exports.partial = exports.type = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; | ||
exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.id = exports.compose = exports.zero = exports.alt = exports.readonly = exports.lazy = exports.sum = exports.union = exports.intersect = exports.tuple = exports.record = exports.array = exports.partial = exports.type = exports.struct = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; | ||
/** | ||
* **This module is experimental** | ||
* | ||
* Experimental features are published in order to get early feedback from the community, see these tracking | ||
* [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. | ||
* | ||
* A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. | ||
* | ||
* @since 2.2.0 | ||
*/ | ||
var function_1 = require("fp-ts/lib/function"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
@@ -84,5 +95,5 @@ var Schemable_1 = require("./Schemable"); | ||
* @category combinators | ||
* @since 2.2.0 | ||
* @since 2.2.15 | ||
*/ | ||
var type = function (properties) { | ||
var struct = function (properties) { | ||
return pipeable_1.pipe(exports.UnknownRecord, exports.refine(function (r) { | ||
@@ -97,7 +108,15 @@ for (var k in properties) { | ||
}; | ||
exports.type = type; | ||
exports.struct = struct; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.0 | ||
* @deprecated | ||
*/ | ||
exports.type = exports.struct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.0 | ||
*/ | ||
var partial = function (properties) { | ||
@@ -201,2 +220,7 @@ return pipeable_1.pipe(exports.UnknownRecord, exports.refine(function (r) { | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
exports.readonly = function_1.identity; | ||
/** | ||
* @category combinators | ||
* @since 2.2.8 | ||
@@ -252,2 +276,3 @@ */ | ||
type: exports.type, | ||
struct: exports.struct, | ||
partial: exports.partial, | ||
@@ -259,3 +284,4 @@ record: exports.record, | ||
sum: exports.sum, | ||
lazy: function (_, f) { return exports.lazy(f); } | ||
lazy: function (_, f) { return exports.lazy(f); }, | ||
readonly: exports.readonly | ||
}; | ||
@@ -262,0 +288,0 @@ /** |
@@ -77,5 +77,5 @@ /** | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @since 2.2.15 | ||
*/ | ||
export declare function fromType<M extends URIS2, E>( | ||
export declare function fromStruct<M extends URIS2, E>( | ||
M: Applicative2C<M, E> & Bifunctor2<M> | ||
@@ -97,5 +97,13 @@ ): ( | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
export declare const fromType: typeof fromStruct | ||
/** | ||
* @category combinators | ||
* @since 2.2.7 | ||
*/ | ||
export declare function fromPartial<M extends URIS2, E>( | ||
@@ -102,0 +110,0 @@ M: Applicative2C<M, E> & Bifunctor2<M> |
@@ -22,3 +22,3 @@ "use strict"; | ||
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; | ||
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.fromStruct = exports.nullable = exports.parse = exports.refine = exports.mapLeftWithInput = exports.literal = exports.fromRefinement = void 0; | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
@@ -101,5 +101,5 @@ var G = __importStar(require("./Guard")); | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @since 2.2.15 | ||
*/ | ||
function fromType(M) { | ||
function fromStruct(M) { | ||
var traverse = traverseRecordWithIndex(M); | ||
@@ -114,7 +114,15 @@ return function (onPropertyError) { return function (properties) { return ({ | ||
} | ||
exports.fromType = fromType; | ||
exports.fromStruct = fromStruct; | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
exports.fromType = fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.7 | ||
*/ | ||
function fromPartial(M) { | ||
@@ -121,0 +129,0 @@ var traverse = traverseRecordWithIndex(M); |
@@ -27,2 +27,3 @@ /** | ||
readonly nullable: <A>(or: HKT<S, A>) => HKT<S, null | A> | ||
/** @deprecated */ | ||
readonly type: <A>( | ||
@@ -38,2 +39,12 @@ properties: { | ||
> | ||
readonly struct: <A>( | ||
properties: { | ||
[K in keyof A]: HKT<S, A[K]> | ||
} | ||
) => HKT< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
@@ -67,2 +78,3 @@ properties: { | ||
readonly lazy: <A>(id: string, f: () => HKT<S, A>) => HKT<S, A> | ||
readonly readonly: <A>(sa: HKT<S, A>) => HKT<S, Readonly<A>> | ||
} | ||
@@ -79,2 +91,3 @@ /** | ||
readonly nullable: <A>(or: Kind<S, A>) => Kind<S, null | A> | ||
/** @deprecated */ | ||
readonly type: <A>( | ||
@@ -90,2 +103,12 @@ properties: { | ||
> | ||
readonly struct: <A>( | ||
properties: { | ||
[K in keyof A]: Kind<S, A[K]> | ||
} | ||
) => Kind< | ||
S, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
@@ -119,2 +142,3 @@ properties: { | ||
readonly lazy: <A>(id: string, f: () => Kind<S, A>) => Kind<S, A> | ||
readonly readonly: <A>(sa: Kind<S, A>) => Kind<S, Readonly<A>> | ||
} | ||
@@ -131,2 +155,3 @@ /** | ||
readonly nullable: <A>(or: Kind2<S, E, A>) => Kind2<S, E, null | A> | ||
/** @deprecated */ | ||
readonly type: <A>( | ||
@@ -143,2 +168,13 @@ properties: { | ||
> | ||
readonly struct: <A>( | ||
properties: { | ||
[K in keyof A]: Kind2<S, E, A[K]> | ||
} | ||
) => Kind2< | ||
S, | ||
E, | ||
{ | ||
[K in keyof A]: A[K] | ||
} | ||
> | ||
readonly partial: <A>( | ||
@@ -173,2 +209,3 @@ properties: { | ||
readonly lazy: <A>(id: string, f: () => Kind2<S, E, A>) => Kind2<S, E, A> | ||
readonly readonly: <A>(sa: Kind2<S, E, A>) => Kind2<S, E, Readonly<A>> | ||
} | ||
@@ -175,0 +212,0 @@ /** |
@@ -136,3 +136,16 @@ /** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const fromStruct: <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]> } | ||
> | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
@@ -147,3 +160,13 @@ export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>( | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>( | ||
properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> } | ||
) => TaskDecoder<unknown, { [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
@@ -245,2 +268,7 @@ export declare const type: <A>( | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <I, A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, Readonly<A>> | ||
/** | ||
* @category Functor | ||
@@ -247,0 +275,0 @@ * @since 2.2.7 |
@@ -22,4 +22,5 @@ "use strict"; | ||
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; | ||
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.readonly = 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.struct = exports.fromType = exports.fromStruct = 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 = __importStar(require("fp-ts/lib/Either")); | ||
var function_1 = require("fp-ts/lib/function"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
@@ -185,14 +186,30 @@ var T = __importStar(require("fp-ts/lib/Task")); | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @since 2.2.15 | ||
*/ | ||
var fromType = function (properties) { | ||
return K.fromType(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
var fromStruct = function (properties) { | ||
return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); | ||
}; | ||
exports.fromType = fromType; | ||
exports.fromStruct = fromStruct; | ||
/** | ||
* Use `fromStruct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.8 | ||
* @deprecated | ||
*/ | ||
exports.fromType = exports.fromStruct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
var struct = function (properties) { return pipeable_1.pipe(exports.UnknownRecord, exports.compose(exports.fromStruct(properties))); }; | ||
exports.struct = struct; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.7 | ||
* @deprecated | ||
*/ | ||
var type = function (properties) { return pipeable_1.pipe(exports.UnknownRecord, exports.compose(exports.fromType(properties))); }; | ||
exports.type = type; | ||
exports.type = exports.struct; | ||
/** | ||
@@ -307,2 +324,7 @@ * @category combinators | ||
K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); | ||
/** | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
exports.readonly = function_1.identity; | ||
// ------------------------------------------------------------------------------------- | ||
@@ -391,2 +413,3 @@ // non-pipeables | ||
type: exports.type, | ||
struct: exports.struct, | ||
partial: exports.partial, | ||
@@ -398,3 +421,4 @@ record: exports.record, | ||
sum: exports.sum, | ||
lazy: exports.lazy | ||
lazy: exports.lazy, | ||
readonly: exports.readonly | ||
}; | ||
@@ -401,0 +425,0 @@ /** |
@@ -51,3 +51,11 @@ import { Refinement } from 'fp-ts/lib/function' | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const struct: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K_1 in keyof A]: A[K_1] }> | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
@@ -89,2 +97,7 @@ export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K_1 in keyof A]: A[K_1] }> | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
export declare const readonly: <A>(type: Type<A>) => Type<Readonly<A>> | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
@@ -91,0 +104,0 @@ */ |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.union = exports.sum = exports.readonly = exports.lazy = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; | ||
/** | ||
@@ -35,2 +35,3 @@ * **This module is experimental** | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
var function_1 = require("fp-ts/lib/function"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
@@ -103,12 +104,20 @@ var t = __importStar(require("./index")); | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @since 2.2.15 | ||
*/ | ||
var type = function (properties) { | ||
var struct = function (properties) { | ||
return t.type(properties); | ||
}; | ||
exports.type = type; | ||
exports.struct = struct; | ||
/** | ||
* Use `struct` instead. | ||
* | ||
* @category combinators | ||
* @since 2.2.3 | ||
* @deprecated | ||
*/ | ||
exports.type = exports.struct; | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
*/ | ||
var partial = function (properties) { | ||
@@ -156,2 +165,7 @@ return t.partial(properties); | ||
* @category combinators | ||
* @since 2.2.15 | ||
*/ | ||
exports.readonly = function_1.identity; | ||
/** | ||
* @category combinators | ||
* @since 2.2.3 | ||
@@ -193,2 +207,3 @@ */ | ||
type: exports.type, | ||
struct: exports.struct, | ||
partial: exports.partial, | ||
@@ -200,3 +215,4 @@ record: exports.record, | ||
sum: exports.sum, | ||
lazy: exports.lazy | ||
lazy: exports.lazy, | ||
readonly: exports.readonly | ||
}; | ||
@@ -203,0 +219,0 @@ /** |
{ | ||
"name": "io-ts", | ||
"version": "2.2.14", | ||
"version": "2.2.15", | ||
"description": "TypeScript runtime type system for IO decoding/encoding", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
456006
16340