TaskDecoder overview

This module is experimental

Experimental features are published in order to get early feedback from the community, see these tracking issues 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.

Added in v2.2.7


Table of contents


Alt

alt

Signature

export declare const alt: <I, A>(that: () => TaskDecoder<I, A>) => (me: TaskDecoder<I, A>) => TaskDecoder<I, A>

Added in v2.2.7

Category

id

Signature

export declare const id: <A>() => TaskDecoder<A, A>

Added in v2.2.8

DecodeError

DecodeError (type alias)

Signature

export type DecodeError = D.DecodeError

Added in v2.2.7

error

Signature

export declare const error: (actual: unknown, message: string) => DecodeError

Added in v2.2.7

failure

Signature

export declare const failure: <A = never>(
  actual: unknown,
  message: string
) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, A>

Added in v2.2.7

success

Signature

export declare const success: <A>(a: A) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, A>

Added in v2.2.7

Functor

map

Signature

export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: TaskDecoder<I, A>) => TaskDecoder<I, B>

Added in v2.2.7

Semigroupoid

compose

Signature

export declare const compose: <A, B>(to: TaskDecoder<A, B>) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>

Added in v2.2.8

combinators

array

Signature

export declare const array: <A>(item: TaskDecoder<unknown, A>) => TaskDecoder<unknown, A[]>

Added in v2.2.7

fromArray

Signature

export declare const fromArray: <I, A>(item: TaskDecoder<I, A>) => TaskDecoder<I[], A[]>

Added in v2.2.8

fromPartial

Signature

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 in keyof P]: K.TypeOf<'TaskEither', P[K]> }>
>

Added in v2.2.8

fromRecord

Signature

export declare const fromRecord: <I, A>(
  codomain: TaskDecoder<I, A>
) => TaskDecoder<Record<string, I>, Record<string, A>>

Added in v2.2.8

fromStruct

Signature

export declare const fromStruct: <P extends Record<string, TaskDecoder<any, any>>>(
  properties: P
) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }>

Added in v2.2.15

fromSum

Signature

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]>>

Added in v2.2.8

fromTuple

Signature

export declare const fromTuple: <C extends readonly TaskDecoder<any, any>[]>(
  ...components: C
) => TaskDecoder<{ [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, { [K in keyof C]: K.TypeOf<'TaskEither', C[K]> }>

Added in v2.2.8

intersect

Signature

export declare const intersect: <IB, B>(
  right: TaskDecoder<IB, B>
) => <IA, A>(left: TaskDecoder<IA, A>) => TaskDecoder<IA & IB, A & B>

Added in v2.2.7

lazy

Signature

export declare const lazy: <I, A>(id: string, f: () => TaskDecoder<I, A>) => TaskDecoder<I, A>

Added in v2.2.7

mapLeftWithInput

Signature

export declare const mapLeftWithInput: <I>(
  f: (input: I, e: DecodeError) => DecodeError
) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A>

Added in v2.2.7

nullable

Signature

export declare const nullable: <I, A>(or: TaskDecoder<I, A>) => TaskDecoder<I | null, A | null>

Added in v2.2.7

parse

Signature

export declare const parse: <A, B>(
  parser: (a: A) => TE.TaskEither<FS.FreeSemigroup<DE.DecodeError<string>>, B>
) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>

Added in v2.2.7

partial

Signature

export declare const partial: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> }) => TaskDecoder<
  unknown,
  Partial<{ [K in keyof A]: A[K] }>
>

Added in v2.2.7

readonly

Signature

export declare const readonly: <I, A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, Readonly<A>>

Added in v2.2.15

record

Signature

export declare const record: <A>(codomain: TaskDecoder<unknown, A>) => TaskDecoder<unknown, Record<string, A>>

Added in v2.2.7

refine

Signature

export declare const refine: <A, B extends A>(
  refinement: Refinement<A, B>,
  id: string
) => <I>(from: TaskDecoder<I, A>) => TaskDecoder<I, B>

Added in v2.2.7

struct

Signature

export declare const struct: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> }) => TaskDecoder<
  unknown,
  { [K in keyof A]: A[K] }
>

Added in v2.2.15

sum

Signature

export declare const sum: <T extends string>(
  tag: T
) => <A>(members: { [K in keyof A]: TaskDecoder<unknown, A[K] & Record<T, K>> }) => TaskDecoder<unknown, A[keyof A]>

Added in v2.2.7

tuple

Signature

export declare const tuple: <A extends readonly unknown[]>(
  ...components: { [K in keyof A]: TaskDecoder<unknown, A[K]> }
) => TaskDecoder<unknown, A>

Added in v2.2.7

union

Signature

export declare const union: <MS extends readonly [TaskDecoder<any, any>, ...TaskDecoder<any, any>[]]>(
  ...members: MS
) => TaskDecoder<K.InputOf<'TaskEither', MS[keyof MS]>, K.TypeOf<'TaskEither', MS[keyof MS]>>

Added in v2.2.7

withMessage

Signature

export declare const withMessage: <I>(
  message: (input: I, e: DecodeError) => string
) => <A>(decoder: TaskDecoder<I, A>) => TaskDecoder<I, A>

Added in v2.2.9

fromType

Use fromStruct instead.

Signature

export declare const fromType: <P extends Record<string, TaskDecoder<any, any>>>(
  properties: P
) => TaskDecoder<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, { [K in keyof P]: K.TypeOf<'TaskEither', P[K]> }>

Added in v2.2.8

type

Use struct instead.

Signature

export declare const type: <A>(properties: { [K in keyof A]: TaskDecoder<unknown, A[K]> }) => TaskDecoder<
  unknown,
  { [K in keyof A]: A[K] }
>

Added in v2.2.7

constructors

fromDecoder

Signature

export declare const fromDecoder: <I, A>(decoder: D.Decoder<I, A>) => TaskDecoder<I, A>

Added in v2.2.7

fromGuard

Signature

export declare const fromGuard: <I, A extends I>(guard: G.Guard<I, A>, expected: string) => TaskDecoder<I, A>

Added in v2.2.7

fromRefinement

Signature

export declare const fromRefinement: <I, A extends I>(
  refinement: Refinement<I, A>,
  expected: string
) => TaskDecoder<I, A>

Added in v2.2.8

literal

Signature

export declare const literal: <A extends readonly [L, ...L[]], L extends S.Literal = S.Literal>(
  ...values: A
) => TaskDecoder<unknown, A[number]>

Added in v2.2.7

instances

Alt

Signature

export declare const Alt: Alt2<'io-ts/TaskDecoder'>

Added in v2.2.8

Category

Signature

export declare const Category: Category2<'io-ts/TaskDecoder'>

Added in v2.2.8

Functor

Signature

export declare const Functor: Functor2<'io-ts/TaskDecoder'>

Added in v2.2.8

Schemable

Signature

export declare const Schemable: S.Schemable2C<'io-ts/TaskDecoder', unknown>

Added in v2.2.8

URI

Signature

export declare const URI: 'io-ts/TaskDecoder'

Added in v2.2.7

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.2.7

WithRefine

Signature

export declare const WithRefine: S.WithRefine2C<'io-ts/TaskDecoder', unknown>

Added in v2.2.8

WithUnion

Signature

export declare const WithUnion: S.WithUnion2C<'io-ts/TaskDecoder', unknown>

Added in v2.2.8

WithUnknownContainers

Signature

export declare const WithUnknownContainers: S.WithUnknownContainers2C<'io-ts/TaskDecoder', unknown>

Added in v2.2.8

model

TaskDecoder (interface)

Signature

export interface TaskDecoder<I, A> extends K.Kleisli<TE.URI, I, DecodeError, A> {}

Added in v2.2.8

primitives

UnknownArray

Signature

export declare const UnknownArray: TaskDecoder<unknown, unknown[]>

Added in v2.2.7

UnknownRecord

Signature

export declare const UnknownRecord: TaskDecoder<unknown, Record<string, unknown>>

Added in v2.2.7

boolean

Signature

export declare const boolean: TaskDecoder<unknown, boolean>

Added in v2.2.7

number

Signature

export declare const number: TaskDecoder<unknown, number>

Added in v2.2.7

string

Signature

export declare const string: TaskDecoder<unknown, string>

Added in v2.2.7

utils

InputOf (type alias)

Signature

export type InputOf<KTD> = K.InputOf<TE.URI, KTD>

Added in v2.2.8

TypeOf (type alias)

Signature

export type TypeOf<KTD> = K.TypeOf<TE.URI, KTD>

Added in v2.2.7

draw

Signature

export declare const draw: (e: DecodeError) => string

Added in v2.2.7