Closed
Description
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:
function noop() {}
export const useMedia = (query: string) => {
if(!browser) {
return readable(false, noop); // 1
}
// Do something real here
}
export const useWindowSize = ({initialWidth = Infinity, initialHeight = Infinity}) => {
if(!browser) {
return {
width: readable(initialWidth, noop), // 2
height: readable(initialHeight, noop), // 3
};
}
// Do something real here
}
Expected behavior
store = readable(neverChangedValue)
etc should be accepted by TypeScript.
Sorry for my bad English
Metadata
Metadata
Assignees
Labels
No labels