function / @typed/fx

RefSubject.fromNullable

Creates Option-valued RefSubject state from a nullable input.

Package version
2.0.0-beta.7
Category
Source adapters
Since
1.18.0
Member of
RefSubject

Import

import { RefSubject } from "@typed/fx";

Access RefSubject.fromNullable 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 fromNullable<A>(value: A | null | undefined, options?: RefSubjectOptions<Option.Option<NonNullable<A>>>): Effect.Effect<RefSubject<Option.Option<NonNullable<A>>>, never, Scope.Scope>;

Why

Converts null and undefined to Option.none and every other value to Option.some, then stores that Option in a writable RefSubject. It does not create Filtered state or add NoSuchElementError.

Ownership and lifetime

Construction requires Scope because it delegates to make; it needs no services and cannot fail. The returned RefSubject owns and publishes subsequent Option writes.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source