Import
import { RefSubject } from "@typed/fx";Access RefSubject.fromFx through the imported RefSubject 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
export declare function fromFx<A, E, R>(fx: Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;Why
Makes fx acquisition explicit while normalizing it into current RefSubject state and subsequent pushed versions.
Ownership and lifetime
The creation Effect requires Scope. It owns initializer acquisition, live source subscriptions, and cleanup; source failures and services stay on reads and pushes.
Examples
import { Effect } from "effect"
import * as RefSubject from "@typed/fx/RefSubject"
import { Fx } from "@typed/fx"
const program = Effect.gen(function* () {
// Create an Fx that emits multiple values
const numbers = Fx.fromIterable([1, 2, 3, 4, 5])
// Create a RefSubject that tracks the latest value
const ref = yield* RefSubject.fromFx(numbers)
// Get the latest value
const latest = yield* ref
console.log(latest) // 5
})Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.