@solidjs/signals 2.0.0-beta.10 → 2.0.0-beta.12
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/dist/dev.js +777 -397
- package/dist/node.cjs +1862 -1540
- package/dist/prod.js +1555 -1222
- package/dist/types/boundaries.d.ts +2 -2
- package/dist/types/core/constants.d.ts +8 -6
- package/dist/types/core/core.d.ts +29 -8
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/effect.d.ts +1 -0
- package/dist/types/core/graph.d.ts +1 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +19 -3
- package/dist/types/core/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/map.d.ts +21 -5
- package/dist/types/signals.d.ts +25 -4
- package/dist/types/src/boundaries.d.ts +173 -0
- package/dist/types/src/core/action.d.ts +35 -0
- package/dist/types/src/core/async.d.ts +6 -0
- package/dist/types/src/core/constants.d.ts +51 -0
- package/dist/types/src/core/context.d.ts +36 -0
- package/dist/types/src/core/core.d.ts +174 -0
- package/dist/types/src/core/dev.d.ts +49 -0
- package/dist/types/src/core/effect.d.ts +32 -0
- package/dist/types/src/core/error.d.ts +38 -0
- package/dist/types/src/core/external.d.ts +45 -0
- package/dist/types/src/core/graph.d.ts +5 -0
- package/dist/types/src/core/heap.d.ts +14 -0
- package/dist/types/src/core/index.d.ts +12 -0
- package/dist/types/src/core/lanes.d.ts +54 -0
- package/dist/types/src/core/owner.d.ts +116 -0
- package/dist/types/src/core/scheduler.d.ts +122 -0
- package/dist/types/src/core/types.d.ts +85 -0
- package/dist/types/src/index.d.ts +9 -0
- package/dist/types/src/map.d.ts +53 -0
- package/dist/types/src/signals.d.ts +512 -0
- package/dist/types/src/store/index.d.ts +9 -0
- package/dist/types/src/store/optimistic.d.ts +45 -0
- package/dist/types/src/store/projection.d.ts +66 -0
- package/dist/types/src/store/reconcile.d.ts +23 -0
- package/dist/types/src/store/store.d.ts +125 -0
- package/dist/types/src/store/storePath.d.ts +58 -0
- package/dist/types/src/store/utils.d.ts +114 -0
- package/dist/types-cjs/boundaries.d.cts +2 -2
- package/dist/types-cjs/core/constants.d.cts +8 -6
- package/dist/types-cjs/core/core.d.cts +29 -8
- package/dist/types-cjs/core/dev.d.cts +1 -1
- package/dist/types-cjs/core/effect.d.cts +1 -0
- package/dist/types-cjs/core/graph.d.cts +1 -0
- package/dist/types-cjs/core/index.d.cts +1 -1
- package/dist/types-cjs/core/scheduler.d.cts +19 -3
- package/dist/types-cjs/core/types.d.cts +2 -0
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/map.d.cts +21 -5
- package/dist/types-cjs/signals.d.cts +25 -4
- package/dist/types-cjs/src/boundaries.d.cts +173 -0
- package/dist/types-cjs/src/core/action.d.cts +35 -0
- package/dist/types-cjs/src/core/async.d.cts +6 -0
- package/dist/types-cjs/src/core/constants.d.cts +51 -0
- package/dist/types-cjs/src/core/context.d.cts +36 -0
- package/dist/types-cjs/src/core/core.d.cts +174 -0
- package/dist/types-cjs/src/core/dev.d.cts +49 -0
- package/dist/types-cjs/src/core/effect.d.cts +32 -0
- package/dist/types-cjs/src/core/error.d.cts +38 -0
- package/dist/types-cjs/src/core/external.d.cts +45 -0
- package/dist/types-cjs/src/core/graph.d.cts +5 -0
- package/dist/types-cjs/src/core/heap.d.cts +14 -0
- package/dist/types-cjs/src/core/index.d.cts +12 -0
- package/dist/types-cjs/src/core/lanes.d.cts +54 -0
- package/dist/types-cjs/src/core/owner.d.cts +116 -0
- package/dist/types-cjs/src/core/scheduler.d.cts +122 -0
- package/dist/types-cjs/src/core/types.d.cts +85 -0
- package/dist/types-cjs/src/index.d.cts +9 -0
- package/dist/types-cjs/src/map.d.cts +53 -0
- package/dist/types-cjs/src/signals.d.cts +512 -0
- package/dist/types-cjs/src/store/index.d.cts +9 -0
- package/dist/types-cjs/src/store/optimistic.d.cts +45 -0
- package/dist/types-cjs/src/store/projection.d.cts +66 -0
- package/dist/types-cjs/src/store/reconcile.d.cts +23 -0
- package/dist/types-cjs/src/store/store.d.cts +125 -0
- package/dist/types-cjs/src/store/storePath.d.cts +58 -0
- package/dist/types-cjs/src/store/utils.d.cts +114 -0
- package/package.json +4 -4
|
@@ -73,7 +73,7 @@ export declare class CollectionQueue extends Queue {
|
|
|
73
73
|
*/
|
|
74
74
|
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
75
75
|
on?: () => any;
|
|
76
|
-
}): import("./signals.js").
|
|
76
|
+
}): import("./signals.js").SourceAccessor<unknown>;
|
|
77
77
|
/**
|
|
78
78
|
* Lower-level primitive that backs the `<Errored>` flow control. Catches
|
|
79
79
|
* thrown errors inside `fn` and invokes `fallback(error, reset)` instead.
|
|
@@ -97,7 +97,7 @@ export declare function createLoadingBoundary(fn: () => any, fallback: () => any
|
|
|
97
97
|
* }
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
|
-
export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): import("./signals.js").
|
|
100
|
+
export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): import("./signals.js").SourceAccessor<unknown>;
|
|
101
101
|
/**
|
|
102
102
|
* Coordinate the reveal timing of sibling loading boundaries.
|
|
103
103
|
*
|
|
@@ -9,12 +9,14 @@ export declare const REACTIVE_DISPOSED: number;
|
|
|
9
9
|
export declare const REACTIVE_OPTIMISTIC_DIRTY: number;
|
|
10
10
|
export declare const REACTIVE_SNAPSHOT_STALE: number;
|
|
11
11
|
export declare const REACTIVE_LAZY: number;
|
|
12
|
+
export declare const REACTIVE_MANUAL_WRITE: number;
|
|
12
13
|
export declare const CONFIG_OWNED_WRITE: number;
|
|
13
14
|
export declare const CONFIG_NO_SNAPSHOT: number;
|
|
14
15
|
export declare const CONFIG_TRANSPARENT: number;
|
|
15
16
|
export declare const CONFIG_IN_SNAPSHOT_SCOPE: number;
|
|
16
17
|
export declare const CONFIG_CHILDREN_FORBIDDEN: number;
|
|
17
18
|
export declare const CONFIG_AUTO_DISPOSE: number;
|
|
19
|
+
export declare const CONFIG_SYNC: number;
|
|
18
20
|
export declare const STATUS_NONE = 0;
|
|
19
21
|
export declare const STATUS_PENDING: number;
|
|
20
22
|
export declare const STATUS_ERROR: number;
|
|
@@ -37,12 +39,12 @@ export declare const defaultContext: {};
|
|
|
37
39
|
*/
|
|
38
40
|
export declare const $REFRESH: unique symbol;
|
|
39
41
|
/**
|
|
40
|
-
* Brand applied to
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* Brand applied to values that participate in the `refresh()` re-run protocol.
|
|
43
|
+
* Accessors receive this handle internally; projected stores expose it through
|
|
44
|
+
* their public return type so user-defined hooks that wrap `createOptimisticStore`
|
|
45
|
+
* / `createProjection` / projection-form `createStore` can have their return
|
|
46
|
+
* types inferred without leaking the internal `$REFRESH` symbol into public type
|
|
47
|
+
* signatures (TS4058).
|
|
46
48
|
*/
|
|
47
49
|
export type Refreshable<T> = T & {
|
|
48
50
|
readonly [$REFRESH]: any;
|
|
@@ -19,6 +19,13 @@ export declare function clearSnapshots(): void;
|
|
|
19
19
|
export declare function recompute(el: Computed<any>, create?: boolean): void;
|
|
20
20
|
export declare function computed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>): Computed<T>;
|
|
21
21
|
export declare function computed<T>(fn: (prev: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: NodeOptions<T>): Computed<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Build an Effect node with all effect-specific fields baked into a single object literal,
|
|
24
|
+
* so V8 sees the full hidden class shape at construction time. Effects always run in lazy
|
|
25
|
+
* mode (recompute is called explicitly by `effect()`), so we hardcode the lazy bits and skip
|
|
26
|
+
* the auto-dispose CONFIG bit (effect() previously cleared it post-construction).
|
|
27
|
+
*/
|
|
28
|
+
export declare function createEffectNode<T>(fn: (prev?: T) => T, effectFn: (val: T, prev: T | undefined) => void | (() => void), errorFn: ((err: unknown, cleanup: () => void) => void | (() => void)) | undefined, type: number, notifyStatus: ((status?: number, error?: any) => void) | undefined, options: NodeOptions<T> | undefined): any;
|
|
22
29
|
export declare function signal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
23
30
|
export declare function signal<T>(v: T, options?: NodeOptions<T>, firewall?: Computed<any>): FirewallSignal<T>;
|
|
24
31
|
export declare function optimisticSignal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
@@ -55,6 +62,21 @@ export declare function setStrictRead(v: string | false): string | false;
|
|
|
55
62
|
export declare function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
|
|
56
63
|
export declare function read<T>(el: Signal<T> | Computed<T>): T;
|
|
57
64
|
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
65
|
+
/**
|
|
66
|
+
* Suppresses automatic recomputation of `el` until the scheduler drains. Used
|
|
67
|
+
* when a manual write should win over dependency changes queued in the same
|
|
68
|
+
* tick. The MANUAL_WRITE flag is cleared by the pending-node drain; projection
|
|
69
|
+
* computeds don't commit values, but they still need the same end-of-tick
|
|
70
|
+
* cleanup point.
|
|
71
|
+
*/
|
|
72
|
+
export declare function suppressComputedRecompute(el: Computed<unknown>): void;
|
|
73
|
+
/**
|
|
74
|
+
* User-facing setter for the memo form of `createSignal(fn)`. Behaves like
|
|
75
|
+
* `setSignal`, but also cancels any pending recompute of the memo so the
|
|
76
|
+
* manual value wins over a value that would otherwise be produced by an
|
|
77
|
+
* upstream change in the same tick.
|
|
78
|
+
*/
|
|
79
|
+
export declare function setMemo<T>(el: Computed<T>, v: T | ((prev: T) => T)): T;
|
|
58
80
|
/**
|
|
59
81
|
* Executes `fn` with the given `owner` set as the current owner. Any reactive
|
|
60
82
|
* primitives (`createSignal`, `createMemo`, `createEffect`, `onCleanup`,
|
|
@@ -117,14 +139,13 @@ export declare function latest<T>(fn: () => T): T;
|
|
|
117
139
|
*/
|
|
118
140
|
export declare function isPending(fn: () => any): boolean;
|
|
119
141
|
/**
|
|
120
|
-
*
|
|
142
|
+
* Invalidates one reactive source, forcing it to re-execute even if its inputs
|
|
143
|
+
* haven't changed.
|
|
121
144
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* `createStore(fn, ...)` or `createProjection(...)` and the projection
|
|
127
|
-
* recomputes.
|
|
145
|
+
* Pass either a Solid-created accessor or a projected store created from
|
|
146
|
+
* `createStore(fn, ...)` / `createProjection(...)`. `refresh()` is a
|
|
147
|
+
* write-like invalidation operation: it does not read the target's value, and
|
|
148
|
+
* refreshing a plain signal accessor is a no-op.
|
|
128
149
|
*
|
|
129
150
|
* Use it to invalidate cached async values (e.g. force a re-fetch) without
|
|
130
151
|
* tearing the consumer down.
|
|
@@ -137,7 +158,7 @@ export declare function isPending(fn: () => any): boolean;
|
|
|
137
158
|
* <button onClick={() => refresh(user)}>Reload</button>
|
|
138
159
|
* ```
|
|
139
160
|
*/
|
|
140
|
-
export declare function refresh<T>(
|
|
161
|
+
export declare function refresh<T>(target: Refreshable<T>): void;
|
|
141
162
|
/**
|
|
142
163
|
* Returns `true` while a `refresh()` call is in progress. Useful for showing
|
|
143
164
|
* a "refreshing" indicator distinct from the initial-load `<Loading>`
|
package/dist/types/core/dev.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface DevHooks {
|
|
|
6
6
|
onStoreNodeUpdate?: (state: any, property: PropertyKey, value: any, prev: any) => void;
|
|
7
7
|
}
|
|
8
8
|
export type DiagnosticSeverity = "warn" | "error";
|
|
9
|
-
export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "SIGNAL_WRITE_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "MISSING_EFFECT_FN";
|
|
9
|
+
export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "SIGNAL_WRITE_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "INVALID_REFRESH_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC";
|
|
10
10
|
export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner";
|
|
11
11
|
export interface DiagnosticEvent {
|
|
12
12
|
sequence: number;
|
|
@@ -3,6 +3,7 @@ export interface Effect<T> extends Computed<T>, Owner {
|
|
|
3
3
|
_effectFn: (val: T, prev: T | undefined) => void | (() => void);
|
|
4
4
|
_errorFn?: (err: unknown, cleanup: () => void) => void;
|
|
5
5
|
_cleanup?: () => void;
|
|
6
|
+
_cleanupRegistered?: boolean;
|
|
6
7
|
_modified: boolean;
|
|
7
8
|
_prevValue: T | undefined;
|
|
8
9
|
_type: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Computed, Link, Signal } from "./types.js";
|
|
2
2
|
export declare function unlinkSubs(link: Link): Link | null;
|
|
3
|
+
export declare function trimStaleDeps(el: Computed<any>): void;
|
|
3
4
|
export declare function unobserved(el: Computed<unknown>): void;
|
|
4
5
|
export declare function link(dep: Signal<any> | Computed<any>, sub: Computed<any>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
|
|
2
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, latest, refresh, isRefreshing, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.js";
|
|
2
|
+
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, setMemo, suppressComputedRecompute, optimisticSignal, optimisticComputed, isPending, latest, refresh, isRefreshing, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.js";
|
|
3
3
|
export { enableExternalSource, _resetExternalSourceConfig, type ExternalSourceFactory, type ExternalSource, type ExternalSourceConfig } from "./external.js";
|
|
4
4
|
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, cleanup, peekNextChildId } from "./owner.js";
|
|
5
5
|
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
|
|
@@ -67,28 +67,33 @@ export declare class Queue implements IQueue {
|
|
|
67
67
|
}
|
|
68
68
|
export declare class GlobalQueue extends Queue {
|
|
69
69
|
_running: boolean;
|
|
70
|
+
_pendingNode: Signal<any> | null;
|
|
70
71
|
_pendingNodes: Signal<any>[];
|
|
71
72
|
_optimisticNodes: OptimisticNode[];
|
|
72
73
|
_optimisticStores: Set<any>;
|
|
73
74
|
static _update: (el: Computed<unknown>) => void;
|
|
74
75
|
static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
|
|
76
|
+
static _runEffect: (el: Computed<unknown>) => void;
|
|
75
77
|
static _clearOptimisticStore: ((store: any) => void) | null;
|
|
76
78
|
flush(): void;
|
|
77
79
|
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
78
80
|
initTransition(transition?: Transition | null): void;
|
|
79
81
|
}
|
|
82
|
+
export declare function queuePendingNode(node: Signal<any>): void;
|
|
80
83
|
export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
|
|
81
84
|
export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
|
|
82
85
|
export declare function trackOptimisticStore(store: any): void;
|
|
83
86
|
export declare const globalQueue: GlobalQueue;
|
|
84
87
|
/**
|
|
85
|
-
* Synchronously processes the pending reactive queue
|
|
86
|
-
*
|
|
88
|
+
* Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
|
|
89
|
+
* flush scope before draining the queue.
|
|
87
90
|
*
|
|
88
91
|
* Reactive updates are normally batched onto the microtask queue, so multiple
|
|
89
92
|
* writes in a row collapse into a single update pass. Call `flush()` when you
|
|
90
93
|
* need to *observe* the result of those writes synchronously — most commonly
|
|
91
|
-
* in tests, but also at the boundary of imperative integration code.
|
|
94
|
+
* in tests, but also at the boundary of imperative integration code. Pass a
|
|
95
|
+
* callback when the writes themselves should bypass microtask scheduling and
|
|
96
|
+
* drain synchronously when the callback returns.
|
|
92
97
|
*
|
|
93
98
|
* @example
|
|
94
99
|
* ```ts
|
|
@@ -98,9 +103,20 @@ export declare const globalQueue: GlobalQueue;
|
|
|
98
103
|
* setCount(5);
|
|
99
104
|
* flush();
|
|
100
105
|
* expect(doubled()).toBe(10);
|
|
106
|
+
*
|
|
107
|
+
* flush(() => setCount(6));
|
|
108
|
+
* expect(doubled()).toBe(12);
|
|
109
|
+
*
|
|
110
|
+
* // Nested flushes drain at each level:
|
|
111
|
+
* flush(() => {
|
|
112
|
+
* setCount(7);
|
|
113
|
+
* flush(() => setCount(8)); // inner drain — effects fire here
|
|
114
|
+
* // outer continues with up-to-date state
|
|
115
|
+
* });
|
|
101
116
|
* ```
|
|
102
117
|
*/
|
|
103
118
|
export declare function flush(): void;
|
|
119
|
+
export declare function flush<T>(fn: () => T): T;
|
|
104
120
|
export declare function currentTransition(transition: Transition): Transition;
|
|
105
121
|
export declare function setActiveTransition(transition: Transition | null): void;
|
|
106
122
|
export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
|
|
@@ -21,6 +21,7 @@ export interface NodeOptions<T> {
|
|
|
21
21
|
_noSnapshot?: boolean;
|
|
22
22
|
unobserved?: () => void;
|
|
23
23
|
lazy?: boolean;
|
|
24
|
+
sync?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export interface RawSignal<T> {
|
|
26
27
|
_subs: Link | null;
|
|
@@ -56,6 +57,7 @@ export interface Owner {
|
|
|
56
57
|
_queue: IQueue;
|
|
57
58
|
_firstChild: Owner | null;
|
|
58
59
|
_nextSibling: Owner | null;
|
|
60
|
+
_prevSibling: Owner | null;
|
|
59
61
|
_pendingDisposal: Disposable | Disposable[] | null;
|
|
60
62
|
_pendingFirstChild: Owner | null;
|
|
61
63
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Dev } from "./core/index.js";
|
|
|
3
3
|
export declare const DEV: Dev | undefined;
|
|
4
4
|
export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.js";
|
|
5
5
|
export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, resolve, onSettled, onCleanup } from "./signals.js";
|
|
6
|
-
export type { Accessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
|
|
6
|
+
export type { Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
|
|
7
7
|
export { mapArray, repeat, type Maybe } from "./map.js";
|
|
8
8
|
export * from "./store/index.js";
|
|
9
9
|
export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.js";
|
package/dist/types/map.d.ts
CHANGED
|
@@ -2,8 +2,14 @@ import { type Accessor } from "./signals.js";
|
|
|
2
2
|
export type Maybe<T> = T | void | null | undefined | false;
|
|
3
3
|
/**
|
|
4
4
|
* Reactively maps an array, reusing the previously-mapped value for unchanged
|
|
5
|
-
* items.
|
|
6
|
-
*
|
|
5
|
+
* items.
|
|
6
|
+
*
|
|
7
|
+
* The callback shape follows the keying mode:
|
|
8
|
+
* - default / `keyed: true` receives `(item, index)` where `item` is the raw
|
|
9
|
+
* row value and `index` is an accessor.
|
|
10
|
+
* - `keyed: false` receives `(item, index)` where `item` is an accessor and
|
|
11
|
+
* `index` is a stable number.
|
|
12
|
+
* - `keyed: item => key` receives accessors for both arguments.
|
|
7
13
|
*
|
|
8
14
|
* This is the underlying helper that powers `<For>`. App code should use
|
|
9
15
|
* `<For>` directly; reach for `mapArray` when implementing custom list
|
|
@@ -19,15 +25,25 @@ export type Maybe<T> = T | void | null | undefined | false;
|
|
|
19
25
|
* ```ts
|
|
20
26
|
* const view = mapArray(
|
|
21
27
|
* items,
|
|
22
|
-
* (item, index) => `${index()}: ${item
|
|
28
|
+
* (item, index) => `${index()}: ${item.label}`,
|
|
23
29
|
* { fallback: () => "no items" }
|
|
24
30
|
* );
|
|
25
31
|
* ```
|
|
26
32
|
*
|
|
27
33
|
* @description https://docs.solidjs.com/reference/reactive-utilities/map-array
|
|
28
34
|
*/
|
|
29
|
-
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value:
|
|
30
|
-
keyed?:
|
|
35
|
+
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Item, index: Accessor<number>) => MappedItem, options?: {
|
|
36
|
+
keyed?: true;
|
|
37
|
+
fallback?: Accessor<any>;
|
|
38
|
+
name?: string;
|
|
39
|
+
}): Accessor<MappedItem[]>;
|
|
40
|
+
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: number) => MappedItem, options: {
|
|
41
|
+
keyed: false;
|
|
42
|
+
fallback?: Accessor<any>;
|
|
43
|
+
name?: string;
|
|
44
|
+
}): Accessor<MappedItem[]>;
|
|
45
|
+
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: Accessor<number>) => MappedItem, options: {
|
|
46
|
+
keyed: (item: Item) => any;
|
|
31
47
|
fallback?: Accessor<any>;
|
|
32
48
|
name?: string;
|
|
33
49
|
}): Accessor<MappedItem[]>;
|
package/dist/types/signals.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Disposable } from "./core/index.js";
|
|
1
|
+
import type { Disposable, Refreshable } from "./core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Low-level reactive-cleanup primitive. Registers a callback that runs when
|
|
4
4
|
* the surrounding owner is disposed.
|
|
@@ -47,7 +47,8 @@ export declare function onCleanup(fn: Disposable): Disposable;
|
|
|
47
47
|
* creating a subscription.
|
|
48
48
|
*/
|
|
49
49
|
export type Accessor<T> = () => T;
|
|
50
|
-
export
|
|
50
|
+
export type SourceAccessor<T> = Refreshable<Accessor<T>>;
|
|
51
|
+
export declare function accessor<T>(node: any): SourceAccessor<T>;
|
|
51
52
|
/**
|
|
52
53
|
* A signal setter. Accepts either a new value or an updater `(prev) => next`.
|
|
53
54
|
*
|
|
@@ -63,7 +64,7 @@ export type Setter<in out T> = {
|
|
|
63
64
|
<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)): U;
|
|
64
65
|
};
|
|
65
66
|
/** A `[get, set]` pair returned from `createSignal` / `createOptimistic`. */
|
|
66
|
-
export type Signal<T> = [get:
|
|
67
|
+
export type Signal<T> = [get: SourceAccessor<T>, set: Setter<T>];
|
|
67
68
|
export type ComputeFunction<Prev, Next extends Prev = Prev> = (v: Prev) => PromiseLike<Next> | AsyncIterable<Next> | Next;
|
|
68
69
|
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Next, p?: Prev) => (() => void) | void;
|
|
69
70
|
export type EffectBundle<Prev, Next extends Prev = Prev> = {
|
|
@@ -89,6 +90,16 @@ export interface EffectOptions extends BaseEffectOptions {
|
|
|
89
90
|
* `insert()` in `render()`).
|
|
90
91
|
*/
|
|
91
92
|
schedule?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Advanced. When true, asserts the compute function returns synchronous
|
|
95
|
+
* values only (never `PromiseLike` / `AsyncIterable`). Skips the
|
|
96
|
+
* async-shape probe in `recompute` for a small fixed-cost win per run.
|
|
97
|
+
* Intended for compiler emissions (`_$effect`) and library code that
|
|
98
|
+
* provably returns sync values. Returning a Promise or async iterable
|
|
99
|
+
* from a `sync: true` effect is undefined behavior — the value will be
|
|
100
|
+
* stored as-is and never awaited.
|
|
101
|
+
*/
|
|
102
|
+
sync?: boolean;
|
|
92
103
|
}
|
|
93
104
|
/** Options for plain signals created with `createSignal(value)` or `createOptimistic(value)`. */
|
|
94
105
|
export interface SignalOptions<T> {
|
|
@@ -136,6 +147,16 @@ export interface MemoOptions<T> {
|
|
|
136
147
|
* never autodispose.
|
|
137
148
|
*/
|
|
138
149
|
lazy?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Advanced. When true, asserts the compute function returns synchronous
|
|
152
|
+
* values only (never `PromiseLike` / `AsyncIterable`). Skips the
|
|
153
|
+
* async-shape probe in `recompute` for a small fixed-cost win per run.
|
|
154
|
+
* Intended for compiler emissions (`_$memo`) and library code that
|
|
155
|
+
* provably returns sync values. Returning a Promise or async iterable
|
|
156
|
+
* from a `sync: true` memo is undefined behavior — the value will be
|
|
157
|
+
* stored as-is and never awaited.
|
|
158
|
+
*/
|
|
159
|
+
sync?: boolean;
|
|
139
160
|
}
|
|
140
161
|
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
141
162
|
/**
|
|
@@ -207,7 +228,7 @@ export declare function createSignal<T>(fn: ComputeFunction<T>, options?: Signal
|
|
|
207
228
|
*
|
|
208
229
|
* @description https://docs.solidjs.com/reference/basic-reactivity/create-memo
|
|
209
230
|
*/
|
|
210
|
-
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: MemoOptions<T>):
|
|
231
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: MemoOptions<T>): SourceAccessor<T>;
|
|
211
232
|
/**
|
|
212
233
|
* Creates a reactive effect with **separate compute and effect phases**.
|
|
213
234
|
*
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Queue, type Computed, type Effect } from "./core/index.js";
|
|
2
|
+
import type { Signal } from "./core/index.js";
|
|
3
|
+
export interface BoundaryComputed<T> extends Computed<T> {
|
|
4
|
+
_propagationMask: number;
|
|
5
|
+
}
|
|
6
|
+
type RevealSlot = CollectionQueue | RevealController;
|
|
7
|
+
type BoolAccessor = () => boolean;
|
|
8
|
+
export type RevealOrder = "sequential" | "together" | "natural";
|
|
9
|
+
type OrderAccessor = () => RevealOrder;
|
|
10
|
+
export declare class RevealController {
|
|
11
|
+
_orderAccessor: OrderAccessor;
|
|
12
|
+
_collapsedAccessor: BoolAccessor;
|
|
13
|
+
_slots: RevealSlot[];
|
|
14
|
+
_parentController?: RevealController;
|
|
15
|
+
_disabled: Signal<boolean>;
|
|
16
|
+
_collapsed: Signal<boolean>;
|
|
17
|
+
_ready: boolean;
|
|
18
|
+
_minimallyReady: boolean;
|
|
19
|
+
_evaluating: boolean;
|
|
20
|
+
constructor(order: OrderAccessor, collapsed: BoolAccessor);
|
|
21
|
+
_forEachOwnedSlot(fn: (slot: RevealSlot) => boolean | void): boolean;
|
|
22
|
+
isReady(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* "Minimally ready" = this group has something visible to show under its own policy.
|
|
25
|
+
* Used by an enclosing `together` group to decide when it can release.
|
|
26
|
+
* - `together`: fully ready (atomic).
|
|
27
|
+
* - `sequential`: the first owned slot is minimally ready (frontier can advance).
|
|
28
|
+
* - `natural`: any owned slot is minimally ready.
|
|
29
|
+
*/
|
|
30
|
+
isMinimallyReady(): boolean;
|
|
31
|
+
register(slot: RevealSlot): void;
|
|
32
|
+
unregister(slot: RevealSlot): void;
|
|
33
|
+
evaluate(disabledOverride?: boolean, collapsedOverride?: boolean): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class CollectionQueue extends Queue {
|
|
36
|
+
_collectionType: number;
|
|
37
|
+
_sources: Set<Computed<any>>;
|
|
38
|
+
_tree?: BoundaryComputed<any>;
|
|
39
|
+
_pending: boolean;
|
|
40
|
+
_disabled: Signal<boolean>;
|
|
41
|
+
_collapsed: Signal<boolean>;
|
|
42
|
+
_revealController?: RevealController;
|
|
43
|
+
_initialized: boolean;
|
|
44
|
+
_onFn: (() => any) | undefined;
|
|
45
|
+
_prevOn: any;
|
|
46
|
+
constructor(type: number);
|
|
47
|
+
run(type: number): void;
|
|
48
|
+
notify(node: Effect<any>, type: number, flags: number, error?: any): boolean;
|
|
49
|
+
checkSources(): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Lower-level primitive that backs the `<Loading>` flow control. Catches
|
|
53
|
+
* pending async reads inside `fn` and renders `fallback` until they settle.
|
|
54
|
+
*
|
|
55
|
+
* App code should use `<Loading fallback={...}>` instead — reach for this only
|
|
56
|
+
* when authoring custom boundary components.
|
|
57
|
+
*
|
|
58
|
+
* @param fn the tracked subtree
|
|
59
|
+
* @param fallback the fallback shown while async reads in `fn` are unresolved
|
|
60
|
+
* @param options `on` — accessor whose value scopes the boundary; when set,
|
|
61
|
+
* transitions caused by writes to other reactive sources are *not* caught
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // Custom boundary component built on top of the primitive.
|
|
66
|
+
* function MyLoading(props: { fallback: JSX.Element; children: JSX.Element }) {
|
|
67
|
+
* return createLoadingBoundary(
|
|
68
|
+
* () => props.children,
|
|
69
|
+
* () => props.fallback
|
|
70
|
+
* ) as unknown as JSX.Element;
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
75
|
+
on?: () => any;
|
|
76
|
+
}): import("./signals.js").SourceAccessor<unknown>;
|
|
77
|
+
/**
|
|
78
|
+
* Lower-level primitive that backs the `<Errored>` flow control. Catches
|
|
79
|
+
* thrown errors inside `fn` and invokes `fallback(error, reset)` instead.
|
|
80
|
+
* `reset()` recomputes the failing sources so the boundary can attempt to
|
|
81
|
+
* recover.
|
|
82
|
+
*
|
|
83
|
+
* App code should use `<Errored fallback={...}>` instead — reach for this only
|
|
84
|
+
* when authoring custom boundary components.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* // Custom boundary that wraps the primitive and adds telemetry.
|
|
89
|
+
* function TracedErrored(props: { fallback: (e: unknown) => JSX.Element; children: JSX.Element }) {
|
|
90
|
+
* return createErrorBoundary(
|
|
91
|
+
* () => props.children,
|
|
92
|
+
* (err, reset) => {
|
|
93
|
+
* reportError(err);
|
|
94
|
+
* return props.fallback(err);
|
|
95
|
+
* }
|
|
96
|
+
* ) as unknown as JSX.Element;
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): import("./signals.js").SourceAccessor<unknown>;
|
|
101
|
+
/**
|
|
102
|
+
* Coordinate the reveal timing of sibling loading boundaries.
|
|
103
|
+
*
|
|
104
|
+
* Accepts reactive accessors:
|
|
105
|
+
* - `order`: `"sequential"` (default) | `"together"` | `"natural"`.
|
|
106
|
+
* - `"sequential"` — classic frontier reveal: siblings reveal in registration order
|
|
107
|
+
* as each resolves; later siblings stay hidden until earlier ones complete.
|
|
108
|
+
* - `"together"` — every direct slot stays on its fallback until the whole group
|
|
109
|
+
* is "minimally ready" (each direct slot has produced its own first visible
|
|
110
|
+
* content under its own order), then the whole group releases at once.
|
|
111
|
+
* - `"natural"` — children reveal independently (as each resolves). At the top
|
|
112
|
+
* level this is a no-op compared to not using `createRevealOrder`; the mode
|
|
113
|
+
* exists for nesting, where the group registers as a single composite slot to
|
|
114
|
+
* any enclosing `createRevealOrder`.
|
|
115
|
+
* - `collapsed`: only meaningful when `order === "sequential"`. When set, tail siblings
|
|
116
|
+
* past the frontier suppress their own fallback output. Ignored under `"together"`
|
|
117
|
+
* and `"natural"` — those orders have no frontier.
|
|
118
|
+
*
|
|
119
|
+
* Nested `createRevealOrder` groups compose: the inner controller registers as a
|
|
120
|
+
* single slot in the outer controller and is held on its fallbacks until the outer
|
|
121
|
+
* releases that slot. Once released, the inner controller runs its own order locally
|
|
122
|
+
* over anything still pending. There is no opt-out from an outer hold.
|
|
123
|
+
*
|
|
124
|
+
* "Minimally ready" is what an order considers its first visible content:
|
|
125
|
+
* - `sequential` — frontier-0 is minimally ready (leaf: on resolve; nested: via its
|
|
126
|
+
* own minimal signal).
|
|
127
|
+
* - `together` — every direct slot is minimally ready.
|
|
128
|
+
* - `natural` — any direct slot has visible content (leaves on resolve; nested
|
|
129
|
+
* composites when fully ready, since natural treats composites as atomic).
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* // Primitive form of `<Reveal>` — coordinate sibling loading boundaries
|
|
134
|
+
* // programmatically. App code uses the JSX `<Reveal>` component instead.
|
|
135
|
+
* // Both options are accessors so they can react to state changes.
|
|
136
|
+
* createRevealOrder(
|
|
137
|
+
* () => renderSiblings(),
|
|
138
|
+
* { order: () => mode(), collapsed: () => true }
|
|
139
|
+
* );
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare function createRevealOrder<T>(fn: () => T, options?: {
|
|
143
|
+
order?: OrderAccessor;
|
|
144
|
+
collapsed?: BoolAccessor;
|
|
145
|
+
}): T;
|
|
146
|
+
/**
|
|
147
|
+
* Resolves a children value to its renderable form: unwraps zero-arg functions
|
|
148
|
+
* (accessors), recursively flattens arrays, and optionally skips
|
|
149
|
+
* non-rendering values (`null`, `undefined`, `true`, `false`, `""`).
|
|
150
|
+
*
|
|
151
|
+
* Used internally by flow components and by the renderer to walk a children
|
|
152
|
+
* tree. App code rarely needs this directly — see `children()` in `solid-js`
|
|
153
|
+
* for the user-facing helper that memoizes the result.
|
|
154
|
+
*
|
|
155
|
+
* @param children value or array of values to flatten
|
|
156
|
+
* @param options
|
|
157
|
+
* - `skipNonRendered` — drop values that won't render
|
|
158
|
+
* - `doNotUnwrap` — leave function children as-is (caller will resolve)
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* // Custom renderer walking a children tree manually. Most authors should
|
|
163
|
+
* // use `children()` from solid-js, which memoizes the resolved value.
|
|
164
|
+
* function renderChildren(value: unknown): unknown {
|
|
165
|
+
* return flatten(value, { skipNonRendered: true });
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare function flatten(children: any, options?: {
|
|
170
|
+
skipNonRendered?: boolean;
|
|
171
|
+
doNotUnwrap?: boolean;
|
|
172
|
+
}): any;
|
|
173
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps a generator function so each invocation runs as a single transaction
|
|
3
|
+
* (a "transition") that batches every signal/store write between yields. The
|
|
4
|
+
* surrounding UI sees one atomic update per yielded step; nothing is committed
|
|
5
|
+
* until the action either completes or the next `yield` resolves.
|
|
6
|
+
*
|
|
7
|
+
* Yield promises (or any awaitable) inside the generator — the action waits
|
|
8
|
+
* for each before continuing, but the writes you made beforehand are already
|
|
9
|
+
* visible (or held by `<Loading>` if optimistic). Yield bare values for
|
|
10
|
+
* synchronous batched steps.
|
|
11
|
+
*
|
|
12
|
+
* Each call returns a `Promise` that resolves with the generator's return
|
|
13
|
+
* value, or rejects if it throws. Pair with `createOptimistic` /
|
|
14
|
+
* `createOptimisticStore` to apply tentative writes that auto-revert if the
|
|
15
|
+
* action fails.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const [todos, setTodos] = createOptimisticStore<Todo[]>([]);
|
|
20
|
+
*
|
|
21
|
+
* const addTodo = action(function* (text: string) {
|
|
22
|
+
* const tempId = crypto.randomUUID();
|
|
23
|
+
* setTodos(t => { t.push({ id: tempId, text, pending: true }); }); // optimistic
|
|
24
|
+
* const saved = yield api.createTodo(text); // network round-trip
|
|
25
|
+
* setTodos(t => {
|
|
26
|
+
* const i = t.findIndex(x => x.id === tempId);
|
|
27
|
+
* if (i >= 0) t[i] = saved;
|
|
28
|
+
* });
|
|
29
|
+
* return saved;
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* await addTodo("buy milk");
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function action<Args extends any[], Y, R>(genFn: (...args: Args) => Generator<Y, R, any> | AsyncGenerator<Y, R, any>): (...args: Args) => Promise<R>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type OptimisticLane } from "./lanes.js";
|
|
2
|
+
import type { Computed } from "./types.js";
|
|
3
|
+
export declare function settlePendingSource(el: Computed<any>): void;
|
|
4
|
+
export declare function handleAsync<T>(el: Computed<T>, result: T | PromiseLike<T> | AsyncIterable<T>, setter?: (value: T) => void): T;
|
|
5
|
+
export declare function clearStatus(el: Computed<any>, clearUninitialized?: boolean): void;
|
|
6
|
+
export declare function notifyStatus(el: Computed<any>, status: number, error: any, blockStatus?: boolean, lane?: OptimisticLane): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const REACTIVE_NONE = 0;
|
|
2
|
+
export declare const REACTIVE_CHECK: number;
|
|
3
|
+
export declare const REACTIVE_DIRTY: number;
|
|
4
|
+
export declare const REACTIVE_RECOMPUTING_DEPS: number;
|
|
5
|
+
export declare const REACTIVE_IN_HEAP: number;
|
|
6
|
+
export declare const REACTIVE_IN_HEAP_HEIGHT: number;
|
|
7
|
+
export declare const REACTIVE_ZOMBIE: number;
|
|
8
|
+
export declare const REACTIVE_DISPOSED: number;
|
|
9
|
+
export declare const REACTIVE_OPTIMISTIC_DIRTY: number;
|
|
10
|
+
export declare const REACTIVE_SNAPSHOT_STALE: number;
|
|
11
|
+
export declare const REACTIVE_LAZY: number;
|
|
12
|
+
export declare const REACTIVE_MANUAL_WRITE: number;
|
|
13
|
+
export declare const CONFIG_OWNED_WRITE: number;
|
|
14
|
+
export declare const CONFIG_NO_SNAPSHOT: number;
|
|
15
|
+
export declare const CONFIG_TRANSPARENT: number;
|
|
16
|
+
export declare const CONFIG_IN_SNAPSHOT_SCOPE: number;
|
|
17
|
+
export declare const CONFIG_CHILDREN_FORBIDDEN: number;
|
|
18
|
+
export declare const CONFIG_AUTO_DISPOSE: number;
|
|
19
|
+
export declare const CONFIG_SYNC: number;
|
|
20
|
+
export declare const STATUS_NONE = 0;
|
|
21
|
+
export declare const STATUS_PENDING: number;
|
|
22
|
+
export declare const STATUS_ERROR: number;
|
|
23
|
+
export declare const STATUS_UNINITIALIZED: number;
|
|
24
|
+
export declare const EFFECT_PURE = 0;
|
|
25
|
+
export declare const EFFECT_RENDER = 1;
|
|
26
|
+
export declare const EFFECT_USER = 2;
|
|
27
|
+
export declare const EFFECT_TRACKED = 3;
|
|
28
|
+
export declare const NOT_PENDING: {};
|
|
29
|
+
export declare const NO_SNAPSHOT: {};
|
|
30
|
+
export declare const STORE_SNAPSHOT_PROPS = "sp";
|
|
31
|
+
export declare const SUPPORTS_PROXY: boolean;
|
|
32
|
+
export declare const defaultContext: {};
|
|
33
|
+
/**
|
|
34
|
+
* Brand symbol used by `Refreshable<T>` values (projection stores, async
|
|
35
|
+
* memos) to expose their underlying computation to `refresh()`. Not part of
|
|
36
|
+
* the user-facing API.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare const $REFRESH: unique symbol;
|
|
41
|
+
/**
|
|
42
|
+
* Brand applied to values that participate in the `refresh()` re-run protocol.
|
|
43
|
+
* Accessors receive this handle internally; projected stores expose it through
|
|
44
|
+
* their public return type so user-defined hooks that wrap `createOptimisticStore`
|
|
45
|
+
* / `createProjection` / projection-form `createStore` can have their return
|
|
46
|
+
* types inferred without leaking the internal `$REFRESH` symbol into public type
|
|
47
|
+
* signatures (TS4058).
|
|
48
|
+
*/
|
|
49
|
+
export type Refreshable<T> = T & {
|
|
50
|
+
readonly [$REFRESH]: any;
|
|
51
|
+
};
|