interface / @typed/fx

Subject.Subject.Class

A constructible service facade whose static side is also the contextual Subject.

Package version
2.0.0-beta.13
Category
Subject services
Since
1.0.0
Member of
Subject.Subject

Import

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

Access Subject.Subject.Class through the imported Subject 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 Class<Self, Id extends string, A, E> extends Service<Self, Id, A, E> {
    new (): Service<Self, Id, A, E>;
}

Why

Supports the class-based Effect service declaration pattern without creating a second runtime object distinct from the static Subject facade.

Ownership and lifetime

Constructing the class returns its service facade; it does not allocate a subject. Use the static make layer to allocate and scope the backing instance.

Construct signatures

Returns the contextual service facade without allocating a subject.

Construct signatures: Why

Enables class Events extends Subject.Service<...>()("Events") {} while retaining the facade’s static Fx, Sink, and layer operations.

Construct signatures: Ownership and lifetime

Construction acquires no resources; the static make layer owns the backing subject.

Examples

import * as Subject from "@typed/fx/Subject"

class Events extends Subject.Service<Events, string>()("Events") {}
const facade = new Events()

Other public imports

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

Source