Type 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.3
Table of contents
combinators
array
Signature
export declare const array: <A>(item: Type<A>) => Type<A[]>
Added in v2.2.3
intersect
Signature
export declare const intersect: <B>(right: Type<B>) => <A>(left: Type<A>) => Type<A & B>
Added in v2.2.3
lazy
Signature
export declare const lazy: <A>(id: string, f: () => Type<A>) => Type<A>
Added in v2.2.3
nullable
Signature
export declare const nullable: <A>(or: Type<A>) => Type<A | null>
Added in v2.2.3
partial
Signature
export declare const partial: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<Partial<{ [K in keyof A]: A[K] }>>
Added in v2.2.3
readonly
Signature
export declare const readonly: <A>(type: Type<A>) => Type<Readonly<A>>
Added in v2.2.15
record
Signature
export declare const record: <A>(codomain: Type<A>) => Type<Record<string, A>>
Added in v2.2.3
refine
Signature
export declare const refine: <A, B extends A>(refinement: Refinement<A, B>, id: string) => (from: Type<A>) => Type<B>
Added in v2.2.3
struct
Signature
export declare const struct: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [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]: Type<A[K] & Record<T, K>> }) => Type<A[keyof A]>
Added in v2.2.3
tuple
Signature
export declare const tuple: <A extends readonly unknown[]>(...components: { [K in keyof A]: Type<A[K]> }) => Type<A>
Added in v2.2.3
union
Signature
export declare const union: <A extends readonly [unknown, ...unknown[]]>(
...members: { [K in keyof A]: Type<A[K]> }
) => Type<A[number]>
Added in v2.2.3
type
Use struct
instead.
Signature
export declare const type: <A>(properties: { [K in keyof A]: Type<A[K]> }) => Type<{ [K in keyof A]: A[K] }>
Added in v2.2.3
constructors
literal
Signature
export declare const literal: <A extends readonly [L, ...L[]], L extends S.Literal = S.Literal>(
...values: A
) => Type<A[number]>
Added in v2.2.3
instances
Schemable
Signature
export declare const Schemable: S.Schemable1<'io-ts/Type'>
Added in v2.2.8
URI
Signature
export declare const URI: 'io-ts/Type'
Added in v2.2.3
URI (type alias)
Signature
export type URI = typeof URI
Added in v2.2.3
WithRefine
Signature
export declare const WithRefine: S.WithRefine1<'io-ts/Type'>
Added in v2.2.8
WithUnion
Signature
export declare const WithUnion: S.WithUnion1<'io-ts/Type'>
Added in v2.2.8
WithUnknownContainers
Signature
export declare const WithUnknownContainers: S.WithUnknownContainers1<'io-ts/Type'>
Added in v2.2.8
model
Type (interface)
Signature
export interface Type<A> extends t.Type<A, unknown, unknown> {}
Added in v2.2.3
primitives
UnknownArray
Signature
export declare const UnknownArray: Type<unknown[]>
Added in v2.2.3
UnknownRecord
Signature
export declare const UnknownRecord: Type<Record<string, unknown>>
Added in v2.2.3
boolean
Signature
export declare const boolean: Type<boolean>
Added in v2.2.3
number
Signature
export declare const number: Type<number>
Added in v2.2.3
string
Signature
export declare const string: Type<string>
Added in v2.2.3