@@ -33,10 +33,13 @@ import { createSignal } from "solid-js";
3333
3434` ` ` ts
3535function createSignal<T >(): Signal <T | undefined >;
36- function createSignal<T >(value : Exclude <T , Function >, options ? : SignalOptions <T >): Signal <T >;
3736function createSignal<T >(
38- fn : ComputeFunction <T >,
39- options ? : SignalOptions <T > & MemoOptions <T >
37+ value : Exclude <T , Function >,
38+ options ? : SignalOptions <T >
39+ ): Signal <T >;
40+ function createSignal<T >(
41+ fn : ComputeFunction <T >,
42+ options ? : SignalOptions <T > & MemoOptions <T >
4043): Signal <T >;
4144` ` `
4245
@@ -59,9 +62,9 @@ optional object with a name for debugging purposes and equals, a comparator func
5962` ` ` ts
6063const [count , setCount ] = createSignal (0 );
6164
62- count (); // 0
63- setCount (1 ); // explicit value
64- setCount (c => c + 1 ); // updater
65+ count (); // 0
66+ setCount (1 ); // explicit value
67+ setCount (( c ) => c + 1 ); // updater
6568` ` `
6669
6770` ` ` ts
@@ -87,31 +90,31 @@ Also used in combination with `SignalOptions` for writable memos
8790
8891` ` ` ts
8992interface MemoOptions < T > {
90- /** Stable identifier for the owner hierarchy */
91- id?: string ;
92- /** Debug name (dev mode only) */
93- name ?: string ;
94- /** When true, the owner is invisible to the ID scheme -- inherits parent ID and doesn't consume a childCount slot */
95- transparent ?: boolean ;
96- /**
97- * Custom equality function, or `false` to always notify subscribers.
98- * Defaults to reference equality (`isEqual`). Pass a comparator (e.g.
99- * `(a, b) => a.id === b.id`) for value-based equality, or `false` to
100- * notify on every recompute regardless of equality.
101- */
102- equals ?: false | ((prev : T , next : T ) => boolean );
103- /** Callback invoked when the computed loses all subscribers */
104- unobserved ?: () => void ;
105- /**
106- * When true, defers the initial computation until the value is first read,
107- * **and** opts the memo into autodisposal — once it has no remaining
108- * subscribers it is torn down and recomputed from scratch on the next read.
109- * Use it for compute-on-demand values that should not retain state across
110- * idle periods. Non-lazy owned memos live for their owner's lifetime and
111- * never autodispose.
112- */
113- lazy ?: boolean ;
114- };
93+ /** Stable identifier for the owner hierarchy */
94+ id?: string ;
95+ /** Debug name (dev mode only) */
96+ name ?: string ;
97+ /** When true, the owner is invisible to the ID scheme -- inherits parent ID and doesn't consume a childCount slot */
98+ transparent ?: boolean ;
99+ /**
100+ * Custom equality function, or `false` to always notify subscribers.
101+ * Defaults to reference equality (`isEqual`). Pass a comparator (e.g.
102+ * `(a, b) => a.id === b.id`) for value-based equality, or `false` to
103+ * notify on every recompute regardless of equality.
104+ */
105+ equals ?: false | ((prev : T , next : T ) => boolean );
106+ /** Callback invoked when the computed loses all subscribers */
107+ unobserved ?: () => void ;
108+ /**
109+ * When true, defers the initial computation until the value is first read,
110+ * **and** opts the memo into autodisposal — once it has no remaining
111+ * subscribers it is torn down and recomputed from scratch on the next read.
112+ * Use it for compute-on-demand values that should not retain state across
113+ * idle periods. Non-lazy owned memos live for their owner's lifetime and
114+ * never autodispose.
115+ */
116+ lazy ?: boolean ;
117+ }
115118` ` `
116119
117120### ` NoInfer `
@@ -126,18 +129,18 @@ Options for plain signals created with `createSignal(value)` or `createOptimisti
126129
127130` ` ` ts
128131interface SignalOptions < T > {
129- /** Debug name (dev mode only) */
130- name?: string ;
131- /**
132- * Custom equality function, or `false` to always notify subscribers.
133- * Defaults to reference equality (`isEqual`). Pass a comparator (e.g.
134- * `(a, b) => a.id === b.id`) for value-based equality, or `false` to
135- * notify on every write regardless of equality.
136- */
137- equals ?: false | ((prev : T , next : T ) => boolean );
138- /** Suppress dev-mode warnings when writing inside an owned scope */
139- ownedWrite ?: boolean ;
140- /** Callback invoked when the signal loses all subscribers */
141- unobserved ?: () => void ;
142- };
132+ /** Debug name (dev mode only) */
133+ name?: string ;
134+ /**
135+ * Custom equality function, or `false` to always notify subscribers.
136+ * Defaults to reference equality (`isEqual`). Pass a comparator (e.g.
137+ * `(a, b) => a.id === b.id`) for value-based equality, or `false` to
138+ * notify on every write regardless of equality.
139+ */
140+ equals ?: false | ((prev : T , next : T ) => boolean );
141+ /** Suppress dev-mode warnings when writing inside an owned scope */
142+ ownedWrite ?: boolean ;
143+ /** Callback invoked when the signal loses all subscribers */
144+ unobserved ?: () => void ;
145+ }
143146` ` `
0 commit comments