Package: effect
Module: Layer
Updates a service in the context with a new implementation.
When to use
Use to adapt or extend a service’s behavior during the creation of a layer.
Details
This function modifies the existing implementation of a service in the
context. It retrieves the current service, applies the provided
transformation function f, and replaces the old service with the
transformed one.
Signature
declare const updateService: { <I, A>(service: Context.Key<I, A>, f: (a: Types.NoInfer<A>) => A): <A1, E1, R1>(layer: Layer<A1, E1, R1>) => Layer<A1, E1, I | R1>; <A1, E1, R1, I, A>(layer: Layer<A1, E1, R1>, service: Context.Key<I, A>, f: (a: Types.NoInfer<A>) => A): Layer<A1, E1, I | R1>; }
Since v3.13.0