diff --git a/CHANGELOG.md b/CHANGELOG.md index 141d5661bc..89249634bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## Unreleased + +* Fix type signatures of `writable` and `readable`. It's possible to invoke them without arguments ([#6291](https://github.com/sveltejs/svelte/issues/6291), [#6345](https://github.com/sveltejs/svelte/issues/6345)) + ## 3.38.2 * Revert hydration optimisation for the time being ([#6279](https://github.com/sveltejs/svelte/issues/6279)) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 7fbc8850de..c0bd145316 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -245,10 +245,10 @@ This makes it possible to wrap almost any other reactive state handling library #### `writable` ```js -store = writable(value: any) +store = writable(value?: any) ``` ```js -store = writable(value: any, (set: (value: any) => void) => () => void) +store = writable(value?: any, start?: (set: (value: any) => void) => () => void) ``` --- @@ -297,14 +297,12 @@ unsubscribe(); // logs 'no more subscribers' #### `readable` ```js -store = readable(value: any, (set: (value: any) => void) => () => void) +store = readable(value?: any, start?: (set: (value: any) => void) => () => void) ``` --- -Creates a store whose value cannot be set from 'outside', the first argument is the store's initial value. - -The second argument to `readable` is the same as the second argument to `writable`, except that it is required with `readable` (since otherwise there would be no way to update the store value). +Creates a store whose value cannot be set from 'outside', the first argument is the store's initial value, and the second argument to `readable` is the same as the second argument to `writable`. ```js import { readable } from 'svelte/store'; diff --git a/site/content/tutorial/06-bindings/06-select-bindings/text.md b/site/content/tutorial/06-bindings/06-select-bindings/text.md index f4972557ab..b9cf2de6ec 100644 --- a/site/content/tutorial/06-bindings/06-select-bindings/text.md +++ b/site/content/tutorial/06-bindings/06-select-bindings/text.md @@ -2,7 +2,7 @@ title: Select bindings --- -We can also use `bind:value` with `` elements. Update line 20: ```html ` elements. Update line 24: Note that the `