You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I think creating a store without a start/stop notifier is totally valid for some special use cases (e.g. SSR friendly).
I write a lot of things like this in my SvelteKit(svelte@3.38.2) app to make Typescript checker happy:
functionnoop(){}exportconstuseMedia=(query: string)=>{if(!browser){returnreadable(false,noop);// 1}// Do something real here}exportconstuseWindowSize=({initialWidth =Infinity, initialHeight =Infinity})=>{if(!browser){return{width: readable(initialWidth,noop),// 2height: readable(initialHeight,noop),// 3};}// Do something real here}
Expected behavior store = readable(neverChangedValue) etc should be accepted by TypeScript.
Sorry for my bad English
The text was updated successfully, but these errors were encountered:
Fixes#6291Fixes#6345
Both writable and readable initialized without any arguments are already valid, but TS complains about it. This makes both allowed to be emptily initialized. It's also possible to invoke readable with one argument only.
Describe the bug
I think creating a store without a start/stop notifier is totally valid for some special use cases (e.g. SSR friendly).
I write a lot of things like this in my SvelteKit(
svelte@3.38.2
) app to make Typescript checker happy:Expected behavior
store = readable(neverChangedValue)
etc should be accepted by TypeScript.Sorry for my bad English
The text was updated successfully, but these errors were encountered: