Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fix-create-projection-seed-inference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@solidjs/signals": patch
"solid-js": patch
---

Fix `createProjection` seed typing so readonly store seeds do not override inference from the projection function return type.
3 changes: 2 additions & 1 deletion packages/solid-signals/src/store/projection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
STORE_WRAP,
storeSetter,
storeTraps,
type NoFn,
type ProjectionOptions,
type Store
} from "./store.js";
Expand Down Expand Up @@ -107,7 +108,7 @@ export function createProjectionInternal<T extends object = {}>(
*/
export function createProjection<T extends object = {}>(
fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>,
seed: Partial<T>,
seed: NoFn<T> | Store<NoFn<T>>,
options?: ProjectionOptions
): Refreshable<Store<T>> {
return createProjectionInternal(fn, seed, options).store;
Expand Down
2 changes: 1 addition & 1 deletion packages/solid/src/client/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ export const createOptimistic: {
*/
export const createProjection: <T extends object = {}>(
fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>,
initialValue: T,
initialValue: NoFn<T> | Store<NoFn<T>>,
options?: ProjectionOptions
) => Refreshable<Store<T>> = ((...args: any[]) =>
(_createProjection || coreProjection)(...args)) as any;
Expand Down
Loading