diff --git a/packages/solid/store/src/server.ts b/packages/solid/store/src/server.ts index 3a9112fca..80a08b75a 100644 --- a/packages/solid/store/src/server.ts +++ b/packages/solid/store/src/server.ts @@ -1,5 +1,19 @@ import type { SetStoreFunction, Store } from "./store.js"; +export type { + ArrayFilterFn, + DeepMutable, + DeepReadonly, + NotWrappable, + Part, + SetStoreFunction, + SolidStore, + Store, + StoreNode, + StorePathRange, + StoreSetter +} from "./store.js"; + export const $RAW = Symbol("state-raw"); export function isWrappable(obj: any) { @@ -103,6 +117,10 @@ export function createMutable(state: T | Store): T { return state as T; } +export function modifyMutable(state: T, modifier: (state: T) => T) { + notSup(); +} + type ReconcileOptions = { key?: string | null; merge?: boolean; @@ -137,3 +155,7 @@ export function produce(fn: (state: T) => void): (state: T) => T { } export const DEV = undefined; + +function notSup(): never { + throw new Error("not supported on server side"); +} diff --git a/packages/solid/store/src/store.ts b/packages/solid/store/src/store.ts index 0e4524833..3402bae1a 100644 --- a/packages/solid/store/src/store.ts +++ b/packages/solid/store/src/store.ts @@ -14,7 +14,7 @@ type DataNode = { (): any; $(value?: any): void; }; -type DataNodes = Record; +export type DataNodes = Record; export type OnStoreNodeUpdate = ( state: StoreNode, diff --git a/packages/solid/web/server/index.ts b/packages/solid/web/server/index.ts index 5c2335dd8..b400d8b77 100644 --- a/packages/solid/web/server/index.ts +++ b/packages/solid/web/server/index.ts @@ -12,12 +12,15 @@ export { Match, Index, ErrorBoundary, + // This overrides mergeProps from dom-expressions/src/server.js mergeProps } from "solid-js"; export const isServer: boolean = true; export const isDev: boolean = false; +// Types for these come from dom-expressions/src/server.d.ts +// These override the functions from dom-expressions that throw on the serverside. export function render() {} export function hydrate() {} export function insert() {}