Options
All
  • Public
  • Public/Protected
  • All
Menu

Package io

@typed/io

Validate the types flowing through your application boundaries.

Index

Namespaces

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

DecodeEffect

DecodeEffect<A>: Effects<DecodeFailure, A>

Type parameters

  • A

InputOf

InputOf<E>: E extends Encoder<infer R, any> ? R : never

Type parameters

  • E

Mixed

Mixed: Type<any, any>

NeverType

NeverType: Type<never>

OutputOf

OutputOf<E>: E extends Encoder<any, infer R> ? R : never

Type parameters

  • E

Props

Props: Readonly<Record<PropertyKey, Any>>

TypeOf

TypeOf<A>: A extends Guard<infer R> ? R : never

Type parameters

  • A

TypeOf

TypeOf<A>: A extends Decoder<infer R> ? R : never

Type parameters

  • A

TypeOf

TypeOf<A>: Of<A>

Type parameters

  • A

Variables

Const Any

Any: Any = Type.fromGuard({ is: (_): _ is any => true }, `Any`, `any`)

Const Array

Array: Guard<ReadonlyArray<unknown>> = Guard.is(isArray)

Const Array

Array: Decoder<ReadonlyArray<unknown>> = Decoder.fromGuard(G.Array,'ReadonlyArray<unknown>',)

Const Boolean

Boolean: Guard<boolean> = Guard.is(isBoolean)

Const Boolean

Boolean: Decoder<boolean> = Decoder.fromGuard(G.Boolean, 'boolean')

Const Boolean

Boolean: Type<boolean> = Type.fromGuard(G.Boolean, `Boolean`, `boolean`)

Const Character

Character: Guard<string & { length: 1 } & { __TYPE__: Type }> = refinement(String, isCharacter)

Const Character

Character: Decoder<string & { length: 1 } & { __TYPE__: Type }> = Decoder.fromGuard(G.Character, 'Character')

Const Character

Character: Type<string & { length: 1 } & { __TYPE__: Type }, string & { length: 1 } & { __TYPE__: Type }> = Type.fromGuard(G.Character, 'Character')

Const Date

Date: Guard<Date> = Guard.is(isDate)

Const Date

Date: Decoder<Date> = Decoder.fromGuard(G.Date, `Date`)

Const Date

Date: Type<Date, Date> = Type.fromGuard(G.Date, `Date`)

Const DecodeFailure

DecodeFailure: unique symbol = Symbol.for('DecodeFailure')

Const EmptyString

EmptyString: Guard<string & { length: Zero } & { __TYPE__: Type }> = refinement(String, isEmptyString)

Const EmptyString

EmptyString: Decoder<string & { length: Zero } & { __TYPE__: Type }> = Decoder.fromGuard(G.EmptyString, `EmptyString`)

Const EmptyString

EmptyString: Type<string & { length: Zero } & { __TYPE__: Type }, string & { length: Zero } & { __TYPE__: Type }> = Type.fromGuard(G.EmptyString, 'EmptyString')

Const False

False: Guard<false> = Guard.is(isFalse)

Const False

False: Decoder<boolean> = Decoder.fromGuard(G.False, 'false')

Const False

False: Type<false> = Type.fromGuard(G.False, `False`, `false`)

Const Function

Function: Guard<Function> = Guard.is(isFunction)

Const Function

Function: Decoder<Function> = Decoder.fromGuard(G.Function, 'Function')

Const Function

Function: Type<Function> = Type.fromGuard(G.Function, `Function`)

Const Integer

Integer: Guard<number & { __TYPE__: Type }> = refinement(Number, isInteger)

Const Integer

Integer: Decoder<number & { __TYPE__: Type }> = Decoder.fromGuard(G.Integer, 'Integer')

Const Integer

Integer: Type<number & { __TYPE__: Type }, number & { __TYPE__: Type }> = Type.fromGuard(G.Integer, 'Integer')

Const Map

Map: Guard<ReadonlyMap<unknown, unknown>> = Guard.is(isMap)

Const Map

Map: MapType<Any, Any> = map(Any, Any)

Const Negative

Negative: Guard<number & { __TYPE__: Type }> = refinement(Number, isNegative)

Const Negative

Negative: Decoder<number & { __TYPE__: Type }> = Decoder.fromGuard(G.Negative, 'Negative')

Const Negative

Negative: Type<number & { __TYPE__: Type }, number & { __TYPE__: Type }> = Type.fromGuard(G.Negative, 'Negative')

Const NegativeInteger

NegativeInteger: Guard<number & { __TYPE__: never }> = refinement(Number, isNegativeInteger)

Const NegativeInteger

NegativeInteger: Decoder<number & { __TYPE__: never }> = Decoder.fromGuard(G.NegativeInteger, 'NegativeInteger')

Const NegativeInteger

NegativeInteger: Type<number & { __TYPE__: never }, number & { __TYPE__: never }> = Type.fromGuard(G.NegativeInteger, 'NegativeInteger')

Const Never

Never: Guard = { is: always(false) } as Guard

Const Never

Never: Decoder = Decoder.fromGuard(G.Never, `never`)

Const NonEmptyString

NonEmptyString: Guard<string & { length: PositiveInteger } & { __TYPE__: Type }> = refinement(String, isNonEmptyString)

Const NonEmptyString

NonEmptyString: Decoder<string & { length: PositiveInteger } & { __TYPE__: Type }> = Decoder.fromGuard(G.NonEmptyString, 'NonEmptyString')

Const NonEmptyString

NonEmptyString: Type<string & { length: PositiveInteger } & { __TYPE__: Type }, string & { length: PositiveInteger } & { __TYPE__: Type }> = Type.fromGuard(G.NonEmptyString, 'NonEmptyString')

Const NonNegative

NonNegative: Guard<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = refinement(Number, isNonNegative)

Const NonNegative

NonNegative: Decoder<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Decoder.fromGuard(G.NonNegative, 'NonNegative')

Const NonNegative

NonNegative: Type<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type }), (number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Type.fromGuard(G.NonNegative, 'NonNegative')

Const NonNegativeInteger

NonNegativeInteger: Guard<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = refinement(Number, isNonNegativeInteger)

Const NonNegativeInteger

NonNegativeInteger: Decoder<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Decoder.fromGuard(G.NonNegativeInteger, 'NonNegativeInteger')

Const NonNegativeInteger

NonNegativeInteger: Type<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type }), (number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Type.fromGuard(G.NonNegativeInteger, 'NonNegativeInteger')

Const NonPositive

NonPositive: Guard<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = refinement(Number, isNonPositive)

Const NonPositive

NonPositive: Decoder<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Decoder.fromGuard(G.NonPositive, 'NonPositive')

Const NonPositive

NonPositive: Type<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type }), (number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Type.fromGuard(G.NonPositive, 'NonPositive')

Const NonPositiveInteger

NonPositiveInteger: Guard<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = refinement(Number, isNonPositiveInteger)

Const NonPositiveInteger

NonPositiveInteger: Decoder<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Decoder.fromGuard(G.NonPositiveInteger, 'NonPositiveInteger')

Const NonPositiveInteger

NonPositiveInteger: Type<(number & { __TYPE__: Type }) | (number & { __TYPE__: Type }), (number & { __TYPE__: Type }) | (number & { __TYPE__: Type })> = Type.fromGuard(G.NonPositiveInteger, 'NonPositiveInteger')

Const NonZero

NonZero: Guard<number & { __TYPE__: Type }> = refinement(Number, isNonZero)

Const NonZero

NonZero: Decoder<number & { __TYPE__: Type }> = Decoder.fromGuard(G.NonZero, 'NonZero')

Const NonZero

NonZero: Type<number & { __TYPE__: Type }, number & { __TYPE__: Type }> = Type.fromGuard(G.NonZero, 'NonZero')

Const NonZeroInteger

NonZeroInteger: Guard<number & { __TYPE__: never }> = refinement(Number, isNonZeroInteger)

Const NonZeroInteger

NonZeroInteger: Decoder<number & { __TYPE__: never }> = Decoder.fromGuard(G.NonZeroInteger, 'NonZeroInteger')

Const NonZeroInteger

NonZeroInteger: Type<number & { __TYPE__: never }, number & { __TYPE__: never }> = Type.fromGuard(G.NonZeroInteger, 'NonZeroInteger')

Const Null

Null: Guard<null> = Guard.is(isNull)

Const Null

Null: Decoder<null> = Decoder.fromGuard(G.Null, `null`)

Const Null

Null: Type<null> = Type.fromGuard(G.Null, `Null`, `null`)

Const Number

Number: Guard<number> = Guard.is(isNumber)

Const Number

Number: Decoder<number> = Decoder.fromGuard(G.Number, `number`)

Const Number

Number: Type<number> = Type.fromGuard(G.Number, 'Number', 'number')

Const Positive

Positive: Guard<number & { __TYPE__: Type }> = refinement(Number, isPositive)

Const Positive

Positive: Decoder<number & { __TYPE__: Type }> = Decoder.fromGuard(G.Positive, 'Positive')

Const Positive

Positive: Type<number & { __TYPE__: Type }, number & { __TYPE__: Type }> = Type.fromGuard(G.Positive, 'Positive')

Const PositiveInteger

PositiveInteger: Guard<number & { __TYPE__: never }> = refinement(Number, isPositiveInteger)

Const PositiveInteger

PositiveInteger: Decoder<number & { __TYPE__: never }> = Decoder.fromGuard(G.PositiveInteger, 'PositiveInteger')

Const PositiveInteger

PositiveInteger: Type<number & { __TYPE__: never }, number & { __TYPE__: never }> = Type.fromGuard(G.PositiveInteger, 'PositiveInteger')

Const Record

Record: Guard<Readonly<Record<PropertyKey, unknown>>> = Guard.is(isRecord)

Const Record

Record: Decoder<{}> = Decoder.fromGuard(G.Record, 'Record<PropertyKey, unknown>')

Const Set

Set: SetType<Any> = set(Any)

Const String

String: Guard<string> = Guard.is(isString)

Const String

String: Type<string> = Type.fromGuard(G.String, `String`, `string`)

Const True

True: Guard<true> = Guard.is(isTrue)

Const True

True: Decoder<boolean> = Decoder.fromGuard(G.True, 'true')

Const True

True: Type<true> = Type.fromGuard(G.True, `True`, `true`)

Const Undefined

Undefined: Guard<undefined> = Guard.is(isUndefined)

Const Undefined

Undefined: Decoder<undefined> = Decoder.fromGuard(G.Undefined, 'undefined')

Const Undefined

Undefined: Type<undefined> = Type.fromGuard(G.Undefined, `Undefined`, `undefined`)

Const Unknown

Unknown: Unknown = Type.fromGuard({ is: (_): _ is unknown => true },`Unknown`,`unknown`,)

Const Uuid

Uuid: Guard<UUID> = refinement(String, isUuid)

Const Uuid

Uuid: Decoder<UUID> = Decoder.fromGuard(G.Uuid, `Uuid`)

Const Uuid

Uuid: Type<UUID> = Type.fromGuard(G.Uuid, `Uuid`)

Const Void

Void: Guard<void> = Guard.is(isUndefined)

Const Void

Void: Decoder<void> = Decoder.fromGuard(G.Void, 'void')

Const Void

Void: Type<void> = Type.fromGuard(G.Void, `Void`, `void`)

Const Zero

Zero: Guard<number & { __TYPE__: Type }> = refinement(Number, isZero)

Const Zero

Zero: Decoder<number & { __TYPE__: Type }> = Decoder.fromGuard(G.Zero, 'Zero')

Const Zero

Zero: Type<number & { __TYPE__: Type }, number & { __TYPE__: Type }> = Type.fromGuard(G.Zero, 'Zero')

Const composeEncoder

composeEncoder: { <A, B, C>(encoder: Encoder<A, B>, type: Type<C, A>): Type<C, B>; <A, B>(encoder: Encoder<A, B>): <C>(type: Type<C, A>) => Type<C, B> } = curry(__composeEncoder) as {<A, B, C>(encoder: Encoder<A, B>, type: Type<C, A>): Type<C, B><A, B>(encoder: Encoder<A, B>): <C>(type: Type<C, A>) => Type<C, B>}

Composes an encoder with a type through function composition Type >>> Encoder

Type declaration

    • Type parameters

      • A

      • B

      • C

      Parameters

      Returns Type<C, B>

    • Type parameters

      • A

      • B

      Parameters

      Returns <C>(type: Type<C, A>) => Type<C, B>

        • Type parameters

          • C

          Parameters

          Returns Type<C, B>

Const decode

decode: { <A>(decoder: Decoder<A>, input: unknown): Effects<DecodeFailure, A>; <A>(decoder: Decoder<A>): (input: unknown) => Effects<DecodeFailure, A> } = curry(__decode)

Type declaration

Const guard

guard: { <A>(guard: Guard<A>, value: unknown): value is A; <A>(guard: Guard<A>): Is<A> } = curry(__guard) as {<A>(guard: Guard<A>, value: unknown): value is A<A>(guard: Guard<A>): Is<A>}

Type declaration

    • <A>(guard: Guard<A>, value: unknown): value is A
    • <A>(guard: Guard<A>): Is<A>
    • Type parameters

      • A

      Parameters

      • guard: Guard<A>
      • value: unknown

      Returns value is A

    • Type parameters

      • A

      Parameters

      Returns Is<A>

Const validateHttpRequest

validateHttpRequest: ValidateHttpRequest = curry(checkHttpRequest)

Functions

Const array

Const array

array

array

  • array<A>(type: A, name?: string): ArrayType<A>

catchDecodeFailure

Const decodeFailure

Const either

Const either

Const either

  • either<A, B>(left: A, right: B): EitherType<A, B>

Const intersection

Const intersection

intersection

  • intersection<A>(encoders: A): Encoder<InputIntersection<A>, OutputIntersection<A>>

intersection

literal

  • literal<A>(...values: A): Guard<A[number]>

literal

  • literal<A>(...values: A): Decoder<A[number]>

literal

Const map

Const map

map

  • map<K, V>(key: K, value: V, name?: string, expected?: string): MapType<K, V>
  • Type parameters

    Parameters

    • key: K
    • value: V
    • Default value name: string = `ReadonlyMap<${key.name}, ${value.name}>`
    • Default value expected: string = `ReadonlyMap<${key.expected}, ${value.expected}>`

    Returns MapType<K, V>

Const maybe

Const maybe

Const maybe

  • maybe<A>(justType: A, name?: string, expected?: string): MaybeType<A>

Const nullable

Const nullable

Const nullable

  • nullable<A>(type: A): Type<null | Of<A>>

partial

  • partial<R>(props: R): Guard<{}>

Const partial

  • partial<A>(decoders: A, expected?: string): Decoder<{}>

partial

  • partial<P>(properties: P): Encoder<Partial<{}>, Partial<{}>>

Const partial

  • partial<A>(properties: A, name: string, expected?: string): PartialType<A>

Const record

  • record<R>(props: R): Guard<{}>

Const record

  • record<A>(decoders: A, expected?: string): Decoder<{}>

record

  • record<P>(properties: P): Encoder<{}, {}>

Const record

  • record<A>(properties: A, name?: string, expected?: string): RecordType<A>

refinement

Const refinement

refinement

  • refinement<A, B>(type: A, refinementF: Refinement<Of<A>, B>, name?: string): Type<B, Type.Encoding<A> extends Type.Of<A> ? B : Type.Encoding<A>>

remoteData

Const remoteData

Const remoteData

  • remoteData<L, R>(left: L, right: R, name?: string): RemoteDataType<L, R>

Const set

  • set<A>(g: A): Guard<ReadonlySet<A extends Guard<R> ? R : never>>

Const set

Const set

  • set<A>(member: A, name?: string): SetType<A>

Const shouldUseIdentity

  • shouldUseIdentity(types: keyof Any[]): boolean

Const tuple

  • tuple<A>(types: A): Guard<{}>

Const tuple

  • tuple<A>(decoders: A): Decoder<{}>

tuple

  • tuple<A>(encoders: A): Encoder<{}, {}>

Const tuple

Const union

Const union

  • union<A>(decoders: A, expected?: string): Decoder<TypeOf<A[number]>>

Const union

  • union<A>(members: A, name?: string): UnionType<A>

Object literals

Const Never

Never: object

encode

encode: <A>(value: A) => A = id

Type declaration

    • <A>(value: A): A
    • Type parameters

      • A

      Parameters

      • value: A

      Returns A

expected

expected: string = "never"

name

name: string = "Never"

decode

is

  • is(_: unknown): _ is never

Const Set

Set: object

is

is: isSet = isSet

Generated using TypeDoc