0Pricing
TypeScript Academy · Lesson

The Effect Type

Understand Effect .

The Effect Type

The central type is Effect<Success, Error, Requirements>. Its three type parameters describe everything a computation can do: what it produces, how it can fail, and what it needs.

import { Effect } from "effect";
// Effect<A, E, R>
//   A = success value type
//   E = error type
//   R = required services (dependencies)

The Success Channel (A)

The first parameter is the value produced on success. Effect.succeed creates an effect that always yields a value with no errors and no requirements.

import { Effect } from "effect";

const ok = Effect.succeed(42);
// Effect<number, never, never>

All lessons in this course

  1. Why Effect Systems Matter
  2. The Effect Type
  3. Composing Effects
  4. Error Channels and Dependencies
← Back to TypeScript Academy