Open
Description
Describe the bug
When I wrap an optional value in a writable store, it becomes non-optional.
Reproduction
These 2 lines are all you need:
let value: string | undefined;
let store = writable(value);
The type of store
is Writable<string>
.
I can work around it by manually specifying the type:
let store = writable<string | undefined>(value);
But it's weird that this is necessary.
Logs
No response
System Info
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Memory: 48.22 MB / 32.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 18.17.1 - ~/Library/pnpm/node
npm: 9.6.7 - ~/Library/pnpm/npm
pnpm: 8.15.3 - ~/Library/pnpm/pnpm
Browsers:
Safari: 17.5
npmPackages:
svelte: ^4.2.18 => 4.2.18
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels