Skip to content

Commit ef6e407

Browse files
committed
Update docs: update param is not optional
1 parent a7e2a61 commit ef6e407

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

site/content/docs/03-run-time.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ This makes it possible to wrap almost any other reactive state handling library
268268
store = writable(value?: any)
269269
```
270270
```js
271-
store = writable(value?: any, start?: (set: (value: any) => void, update?: (fn: any => any) => void) => () => void)
271+
store = writable(value?: any, start?: (set: (value: any) => void, update: (fn: any => any) => void) => () => void)
272272
```
273273

274274
---
@@ -295,7 +295,7 @@ count.update(n => n + 1); // logs '2'
295295

296296
---
297297

298-
If a function is passed as the second argument, it will be called when the number of subscribers goes from zero to one (but not from one to two, etc). That function will be passed a `set` function which changes the value of the store, and optionally an `update` function which works like the `update` method on the store, taking a callback to calculate the store's new value from its old value. It must return a `stop` function that is called when the subscriber count goes from one to zero.
298+
If a function is passed as the second argument, it will be called when the number of subscribers goes from zero to one (but not from one to two, etc). That function will be passed a `set` function which changes the value of the store, and an `update` function which works like the `update` method on the store, taking a callback to calculate the store's new value from its old value. It must return a `stop` function that is called when the subscriber count goes from one to zero.
299299

300300
```js
301301
import { writable } from 'svelte/store';
@@ -319,7 +319,7 @@ Note that the value of a `writable` is lost when it is destroyed, for example wh
319319
#### `readable`
320320

321321
```js
322-
store = readable(value?: any, start?: (set: (value: any) => void) => () => void)
322+
store = readable(value?: any, start?: (set: (value: any) => void, update: (fn: any => any) => void) => () => void)
323323
```
324324

325325
---
@@ -356,13 +356,13 @@ const ticktock = readable(null, (set, update) => {
356356
store = derived(a, callback: (a: any) => any)
357357
```
358358
```js
359-
store = derived(a, callback: (a: any, set: (value: any) => void, update?: (fn: any => any) => void) => void | () => void, initial_value: any)
359+
store = derived(a, callback: (a: any, set: (value: any) => void, update: (fn: any => any) => void) => void | () => void, initial_value: any)
360360
```
361361
```js
362362
store = derived([a, ...b], callback: ([a: any, ...b: any[]]) => any)
363363
```
364364
```js
365-
store = derived([a, ...b], callback: ([a: any, ...b: any[]], set: (value: any) => void, update?: (fn: any => any) => void) => void | () => void, initial_value: any)
365+
store = derived([a, ...b], callback: ([a: any, ...b: any[]], set: (value: any) => void, update: (fn: any => any) => void) => void | () => void, initial_value: any)
366366
```
367367

368368
---

0 commit comments

Comments
 (0)