function / @typed/fx/RefSubject

isRefSubject

Checks if a value is a RefSubject.

Package version
2.0.0-beta.13
Category
Type guards
Since
1.0.0

Import

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

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