function / @typed/fx

RefSubject.isRefSubject

Checks if a value is a RefSubject.

Package version
2.0.0-beta.7
Category
Type guards
Since
1.0.0
Member of
RefSubject

Import

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

Access RefSubject.isRefSubject 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 isRefSubject(value: any): value is RefSubject<any, any, any>;

Why

Checks if a value is a RefSubject.

Ownership and lifetime

The derived ref owns no independent state or subscription. It follows the source lifetime and routes writes through the source’s synchronized update boundary.

Examples

import { Effect } from "effect"
import * as RefSubject from "@typed/fx/RefSubject"

const program = Effect.gen(function* () {
  const ref = yield* RefSubject.make(42)
  const isRef = RefSubject.isRefSubject(ref)
  console.log(isRef) // true

  const notRef = { value: 42 }
  const isNotRef = RefSubject.isRefSubject(notRef)
  console.log(isNotRef) // false
})

Other public imports

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

Source