/** * @since 2.2.0 */ import { Either } from 'fp-ts/es6/Either'; import { NonEmptyArray } from 'fp-ts/es6/NonEmptyArray'; import { Forest, Tree } from 'fp-ts/es6/Tree'; import * as G from './Guard'; import { Literal, Schemable1, WithRefinement1, WithUnion1, WithUnknownContainers1 } from './Schemable'; import { Functor1 } from 'fp-ts/es6/Functor'; import { Alt1 } from 'fp-ts/es6/Alt'; /** * @since 2.2.2 */ export interface DecodeError extends NonEmptyArray> { } /** * @since 2.2.0 */ export interface Decoder { readonly decode: (u: unknown) => Either; } /** * @since 2.2.0 */ export declare type TypeOf = D extends Decoder ? A : never; /** * @since 2.2.0 */ export declare function tree(value: A, forest?: Forest): Tree; /** * @since 2.2.0 */ export declare function success(a: A): Either; /** * @since 2.2.0 */ export declare function failure(message: string): Either; /** * @since 2.2.2 */ export declare function isNotEmpty(as: ReadonlyArray): as is NonEmptyArray; /** * @since 2.2.3 */ export declare function of(a: A): Decoder; /** * @since 2.2.0 */ export declare function fromGuard(guard: G.Guard, expected: string): Decoder; /** * @since 2.2.0 */ export declare function literal>(...values: A): Decoder; /** * @since 2.2.0 */ export declare const never: Decoder; /** * @since 2.2.0 */ export declare const string: Decoder; /** * @since 2.2.0 */ export declare const number: Decoder; /** * @since 2.2.0 */ export declare const boolean: Decoder; /** * @since 2.2.0 */ export declare const UnknownArray: Decoder>; /** * @since 2.2.0 */ export declare const UnknownRecord: Decoder>; /** * @since 2.2.0 */ export declare function withExpected(decoder: Decoder, expected: (actual: unknown, e: DecodeError) => DecodeError): Decoder; /** * @since 2.2.0 */ export declare function refinement(from: Decoder, refinement: (a: A) => a is B, expected: string): Decoder; /** * @since 2.2.0 */ export declare function parse(from: Decoder, parser: (a: A) => Either): Decoder; /** * @since 2.2.0 */ export declare function nullable(or: Decoder): Decoder; /** * @since 2.2.0 */ export declare function type(properties: { [K in keyof A]: Decoder; }): Decoder<{ [K in keyof A]: A[K]; }>; /** * @since 2.2.0 */ export declare function partial(properties: { [K in keyof A]: Decoder; }): Decoder>; /** * @since 2.2.0 */ export declare function record(codomain: Decoder): Decoder>; /** * @since 2.2.0 */ export declare function array(items: Decoder): Decoder>; /** * @since 2.2.0 */ export declare function tuple>(...components: { [K in keyof A]: Decoder; }): Decoder; /** * @since 2.2.0 */ export declare function intersection(left: Decoder, right: Decoder): Decoder; /** * @since 2.2.0 */ export declare function lazy(id: string, f: () => Decoder): Decoder; /** * @since 2.2.0 */ export declare function sum(tag: T): (members: { [K in keyof A]: Decoder; }) => Decoder; /** * @since 2.2.0 */ export declare function union>(...members: { [K in keyof A]: Decoder; }): Decoder; /** * @since 2.2.0 */ export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder; /** * @since 2.2.0 */ export declare const alt: (that: () => Decoder) => (fa: Decoder) => Decoder; /** * @since 2.2.0 */ export declare const URI = "io-ts/Decoder"; /** * @since 2.2.0 */ export declare type URI = typeof URI; declare module 'fp-ts/es6/HKT' { interface URItoKind { readonly [URI]: Decoder; } } /** * @since 2.2.3 */ export declare const functorDecoder: Functor1; /** * @since 2.2.3 */ export declare const altDecoder: Alt1; /** * @since 2.2.3 */ export declare const schemableDecoder: Schemable1 & WithUnknownContainers1 & WithUnion1 & WithRefinement1;