@mmstack/primitives 21.0.16 → 21.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -228,7 +228,6 @@ declare function mutable<T>(initial: T, opt?: CreateSignalOptions<T>): MutableSi
|
|
|
228
228
|
*/
|
|
229
229
|
declare function isMutable<T = any>(value: WritableSignal<T>): value is MutableSignal<T>;
|
|
230
230
|
|
|
231
|
-
type UnknownObject = Record<PropertyKey, unknown>;
|
|
232
231
|
/**
|
|
233
232
|
* Options for creating a derived signal using the full `derived` function signature.
|
|
234
233
|
* @typeParam T - The type of the source signal's value (parent).
|
|
@@ -307,7 +306,7 @@ declare function derived<T, U>(source: WritableSignal<T>, opt: CreateDerivedOpti
|
|
|
307
306
|
* console.log(user().name); // Outputs: Jane
|
|
308
307
|
* ```
|
|
309
308
|
*/
|
|
310
|
-
declare function derived<T extends
|
|
309
|
+
declare function derived<T extends object, TKey extends keyof T>(source: MutableSignal<T>, key: TKey, opt?: CreateSignalOptions<T[TKey]>): DerivedSignal<T, T[TKey]> & MutableSignal<T[TKey]>;
|
|
311
310
|
/**
|
|
312
311
|
* Creates a `DerivedSignal` that derives a property from an object held by the source signal.
|
|
313
312
|
* This overload is a convenient shorthand for accessing object properties.
|
|
@@ -332,7 +331,7 @@ declare function derived<T extends UnknownObject, TKey extends keyof T>(source:
|
|
|
332
331
|
* console.log(user().name); // Outputs: Jane
|
|
333
332
|
* ```
|
|
334
333
|
*/
|
|
335
|
-
declare function derived<T extends
|
|
334
|
+
declare function derived<T extends object, TKey extends keyof T>(source: WritableSignal<T>, key: TKey, opt?: CreateSignalOptions<T[TKey]>): DerivedSignal<T, T[TKey]>;
|
|
336
335
|
/**
|
|
337
336
|
* Creates a `DerivedSignal` that derives its value from another `MutableSignal`.
|
|
338
337
|
* Use mutuable signals with caution, but very useful for deeply nested structures.
|
|
@@ -577,16 +576,16 @@ declare function keyArray<T, U, K>(source: Signal<T[]> | (() => T[]), mapFn: (v:
|
|
|
577
576
|
key?: (item: T) => K;
|
|
578
577
|
}): Signal<U[]>;
|
|
579
578
|
|
|
580
|
-
type MappedObject<T extends
|
|
579
|
+
type MappedObject<T extends object, U> = {
|
|
581
580
|
[K in keyof T]: U;
|
|
582
581
|
};
|
|
583
|
-
declare function mapObject<T extends
|
|
582
|
+
declare function mapObject<T extends object, U>(source: MutableSignal<T>, mapFn: <K extends keyof T>(key: K, value: MutableSignal<T[K]>) => U, options?: {
|
|
584
583
|
onDestroy?: (value: U) => void;
|
|
585
584
|
}): Signal<MappedObject<T, U>>;
|
|
586
|
-
declare function mapObject<T extends
|
|
585
|
+
declare function mapObject<T extends object, U>(source: WritableSignal<T>, mapFn: <K extends keyof T>(key: K, value: WritableSignal<T[K]>) => U, options?: {
|
|
587
586
|
onDestroy?: (value: U) => void;
|
|
588
587
|
}): Signal<MappedObject<T, U>>;
|
|
589
|
-
declare function mapObject<T extends
|
|
588
|
+
declare function mapObject<T extends object, U>(source: (() => T) | Signal<T>, mapFn: <K extends keyof T>(key: K, value: Signal<T[K]>) => U, options?: {
|
|
590
589
|
onDestroy?: (value: U) => void;
|
|
591
590
|
}): Signal<MappedObject<T, U>>;
|
|
592
591
|
|