core / type
BaseSourceSignal
Base source signal type with value getter/setter.
Base source signal type with value getter/setter.
Signature
export type BaseSourceSignal<T> = {
/** Runtime type discriminator for source signals */
type: "source-signal";
/** Getter/setter for the signal's value */
value: T;
};
/**
* Source signal for arrays with mutation methods.
*
* @template T - The array type
*
* @see BaseArraySignal - For array mutation methods
*/
export type ArraySourceSignal<T extends any[]> = BaseSourceSignal<T> &
BaseArraySignal<T>;
/**
* Source signal for plain objects with partial update method.
*
* @template T - The object type
*
* @see BaseObjectSignal - For object mutation methods
*/
export type ObjectSourceSignal<T extends object> = BaseSourceSignal<T> &
BaseObjectSignal<T>;
/**
* A mutable source signal created from plain JavaScript data.
*
* Source signals can notify dependent computations when their value changes.
* The specific type (array, object, or primitive) determines which additional
* methods are available.
*
* @template T - The type of value the signal holds
*
* @remarks
* - For arrays: includes array mutation methods (push, pop, splice, etc.)
* - For plain objects: includes `set()` method for partial updates
* - For primitives: only the base signal interface
*
* @see signal - For creating source signals
* @see DerivedSignal - For read-only derived signals
*/
export type SourceSignal<T> = T extends any[]
? ArraySourceSignal<T>
: T extends object
? ObjectSourceSignal<T>
: BaseSourceSignal<T>;
Type Parameters
- The type of value the signal holds