Skip to content

First argument to writable/readable should be optional #6291

Closed
@Rich-Harris

Description

@Rich-Harris

Describe the bug
It's totally valid to create a store without an initial value, but TypeScript complains:

image

Expected behavior
store = writable() etc should be accepted by TypeScript. I guess value: T here just needs to be value?: T (and similarly for readable)?

export function writable<T>(value: T, start: StartStopNotifier<T> = noop): Writable<T> {

Information about your Svelte project:
It's a SvelteKit project using svelte@3.37.0

Severity
Minor — easily worked around with writable(undefined)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions