Import
import { Fx } from "@typed/fx";Access Fx.Fx.Service through the imported Fx export. Its declaration below describes the member.
This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.
Signatures
interface Service<Self, Id extends string, A, E> extends Fx<A, E, Self> {
readonly id: Id;
readonly service: Context.Service<Self, Fx<A, E>>;
readonly make: <R = never>(fx: Fx<A, E, R> | Effect.Effect<Fx<A, E, R>, E, R>) => Layer<Self, E, Exclude<R, Scope.Scope>>;
}Why
Long-lived producers can be selected and replaced through Effect’s service graph
while remaining directly usable as Fx<A, E, Self>.
Ownership and lifetime
The service declaration owns nothing. A layer made with make owns the supplied
producer for that layer’s scope; each run reads the installed service.
Property: id
Stable diagnostic identifier used to create the Effect service.
Property: id: Why
Keeps the service identity visible to diagnostics and tooling.
Property: id: Ownership and lifetime
Reading the identifier starts no work and owns no resource.
Property: make
Builds a layer from an Fx, or from an Effect that acquires one.
Property: make: Why
Connects producer acquisition directly to Effect’s service graph.
Property: make: Ownership and lifetime
Scope is removed from the layer requirements because layer acquisition supplies it. Other services and typed failures remain visible.
Property: service
Effect service tag containing the installed producer.
Property: service: Why
Exposes the underlying Effect service for direct context and layer composition.
Property: service: Ownership and lifetime
The tag is inert; the layer that installs its value owns the producer lifetime.
Examples
import { Fx } from "@typed/fx"
import type { Fx as FxModel } from "@typed/fx/Fx"
class Ticks extends Fx.Service<Ticks, number>()("app/Ticks") {}
const service: FxModel.Service<Ticks, "app/Ticks", number, never> = TicksOther public imports
These import paths expose the same declaration. Each page retains its own public name and signature.