effect-io-ai

Package: effect
Module: Layer

Layer.PartialEffectful

A utility type for creating partial mocks of services in testing.

When to use

Use to type partial test service implementations where only exercised effectful members are stubbed.

Details

This type makes Effect, Stream, and Channel values and functions returning them optional, while keeping non-effectful properties required. This allows you to provide only the methods you need to test while leaving others unimplemented.

See

Signature

type PartialEffectful<A> = Types.Simplify<
  & {
    [K in keyof A as A[K] extends AnyEffectOrStream ? K : never]?: A[K]
  }
  & {
    [K in keyof A as A[K] extends AnyEffectOrStream ? never : K]: A[K]
  }
>

Source

Since v3.17.0