Effect-TS brings functional programming patterns to TypeScript. Effects represent computations with typed errors and requirements. Composition builds complex programs from simple pieces. Structured concurrency manages parallel operations.
Core Concepts
Effects describe computations without executing. Error types appear in function signatures. Dependencies declare requirements. Layers provide implementations.
- Model operations as Effects with typed errors
- Use pipe for readable composition
- Declare dependencies in function signatures
- Provide dependencies with Layers
- Handle errors with typed error channels
Practical Benefits
Typed errors prevent unhandled exceptions. Dependency injection improves testability. Structured concurrency prevents resource leaks. Schema validation integrates seamlessly.