effex-monorepo
    Preparing search index...

    Type Alias SignalStruct<T>

    SignalStruct: SignalStructBase<T> & SignalStructFields<T>

    A reactive struct with fixed keys, where each key is accessible as a Signal. This allows granular updates to individual fields without reconstructing the whole object.

    Type Parameters

    • T extends Record<string, unknown>

      The struct type (must be a Record)

    const address = yield* Signal.Struct.make({
    street: "123 Main St",
    city: "Austin",
    zip: "78701",
    });

    // Access individual fields as Signals
    yield* address.street.set("456 Oak Ave");
    yield* address.city.set("Dallas");

    // Read whole struct
    const value = yield* address.get; // { street: "456 Oak Ave", city: "Dallas", zip: "78701" }

    // Batch update multiple fields
    yield* address.update({ street: "789 Pine Rd", city: "Houston" });

    // Replace entire struct
    yield* address.replace({ street: "100 New St", city: "San Antonio", zip: "78201" });