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

EffectFn overview

EffectFn is a type-alias for a function that returns an Effect.

Added in v1.0.0


Table of contents


models

EffectFn (interface)

EffectFn is a type-alias for a function that returns an Effect.

Signature

export interface EffectFn<Args extends ReadonlyArray<any> = ReadonlyArray<any>, A = any, E = any, R = any> {
  (...args: Args): Effect.Effect<A, E, R>
}

Added in v1.0.0

utils

EffectFn (namespace)

Added in v1.0.0

ArgsOf (type alias)

A helper for extracting the arguments of an EffectFn.

Signature

export type ArgsOf<T extends EffectFn> = T extends (
  ...args: infer Args
) => // eslint-disable-next-line @typescript-eslint/no-unused-vars
Effect.Effect<infer _A, infer _E, infer _R>
  ? Args
  : never

Added in v1.0.0

Context (type alias)

A helper for extracting the context of an EffectFn.

Signature

export type Context<T extends EffectFn> = T extends (
  ...args: infer _Args
) => // eslint-disable-next-line @typescript-eslint/no-unused-vars
Effect.Effect<infer _A, infer _E, infer R>
  ? R
  : never

Added in v1.0.0

Error (type alias)

A helper for extracting the error of an EffectFn.

Signature

export type Error<T extends EffectFn> = T extends (
  ...args: infer _Args
) => // eslint-disable-next-line @typescript-eslint/no-unused-vars
Effect.Effect<infer _A, infer E, infer _R>
  ? E
  : never

Added in v1.0.0

Extendable (type alias)

A helper for utilizing an EffectFn in an extends clause.

Signature

export type Extendable<T extends EffectFn> = T extends (...args: infer Args) => Effect.Effect<infer A, infer E, infer R>
  ? (...args: Args) => Effect.Effect<A, E, [R] extends [never] ? any : R>
  : never

Added in v1.0.0

Success (type alias)

A helper for extracting the success of an EffectFn.

Signature

export type Success<T extends EffectFn> = T extends (
  ...args: infer _Args
) => // eslint-disable-next-line @typescript-eslint/no-unused-vars
Effect.Effect<infer A, infer _E, infer _R>
  ? A
  : never

Added in v1.0.0