Skip to main content Link Search Menu Expand Document (external link)

Schema overview

Added in v1.0.0


Table of contents


utils

AsyncData

Signature

export declare const AsyncData: <A, AI, R1, E, EI, R2>(
  valueSchema: Schema.Schema<A, AI, R2>,
  errorSchema: Schema.Schema<E, EI, R1>
) => Schema.Schema<_AsyncData.AsyncData<A, E>, AsyncDataFrom<AI, EI>, R1 | R2>

Added in v1.0.0

AsyncDataFrom (type alias)

Signature

export type AsyncDataFrom<A, E> = NoDataFrom | LoadingFrom | FailureFrom<E> | SuccessFrom<A> | OptimisticFrom<A, E>

Added in v1.0.0

AsyncDataFromSelf

Signature

export declare const AsyncDataFromSelf: <A, AI, R1, E, EI, R2>(
  value: Schema.Schema<A, AI, R2>,
  error: Schema.Schema<E, EI, R1>
) => Schema.Schema<_AsyncData.AsyncData<A, E>, _AsyncData.AsyncData<AI, EI>, R1 | R2>

Added in v1.0.0

FailureFrom (type alias)

Signature

export type FailureFrom<E> = {
  readonly _tag: "Failure"
  readonly cause: Schema.CauseEncoded<E, unknown>
  readonly timestamp: number
  readonly refreshing?: LoadingFrom | undefined
}

Added in v1.0.0

LoadingFrom (type alias)

Signature

export type LoadingFrom = {
  readonly _tag: "Loading"
  readonly timestamp: number
  readonly progress?: ProgressFrom | undefined
}

Added in v1.0.0

NoDataFrom (type alias)

Signature

export type NoDataFrom = { readonly _tag: "NoData" }

Added in v1.0.0

OptimisticFrom (type alias)

Signature

export type OptimisticFrom<A, E> = {
  readonly timestamp: number
  readonly _tag: "Optimistic"
  readonly value: A
  readonly previous: AsyncDataFrom<A, E>
}

Added in v1.0.0

Progress

Signature

export declare const Progress: Schema.Schema<
  P.Progress,
  { readonly loaded: string; readonly total?: string | undefined },
  never
>

Added in v1.0.0

ProgressFrom (type alias)

Signature

export type ProgressFrom = {
  readonly loaded: string
  readonly total?: string | undefined
}

Added in v1.0.0

SuccessFrom (type alias)

Signature

export type SuccessFrom<A> = {
  readonly timestamp: number
  readonly _tag: "Success"
  readonly value: A
  readonly refreshing?: LoadingFrom | undefined
}

Added in v1.0.0

asyncDataFromJson

Signature

export declare const asyncDataFromJson: <A, AI, R1, E, EI, R2>(
  value: Schema.Schema<A, AI, R1>,
  error: Schema.Schema<E, EI, R2>
) => Schema.Schema<AsyncDataFrom<A, E>, AsyncDataFrom<AI, EI>, R1 | R2>

Added in v1.0.0