Skip to content

fix(signals): require complete store seeds - #3258

Open
GabbeV wants to merge 2 commits into
solidjs:nextfrom
GabbeV:fix/require-complete-store-seeds
Open

fix(signals): require complete store seeds#3258
GabbeV wants to merge 2 commits into
solidjs:nextfrom
GabbeV:fix/require-complete-store-seeds

Conversation

@GabbeV

@GabbeV GabbeV commented Sep 3, 2026

Copy link
Copy Markdown

Summary

Split from #3194 to isolate the seed type-safety change.

Derived store APIs currently accept a Partial<T> seed while exposing both the returned store and the projection draft as a complete T. This allows required properties to be absent at runtime even though reads and mutations are typed as if they are present.

This changes the seed to a complete T for createStore(fn, seed), createProjection, and createOptimisticStore(fn, seed) across the signals, client, and server declarations. It also applies the existing NoFn<T> exclusion consistently, since a callable root cannot be distinguished from the function form by the runtime dispatch.

Existing tests that intentionally initialize from {} and establish the complete value through mutation now use {} as any. This preserves that pattern as an explicit unsafe escape hatch rather than claiming it is type-safe.

No runtime behavior is intended to change.

How did you test this change?

  • Ran pnpm types in packages/signals.
  • Ran pnpm exec tsc -p tsconfig.build.json --noEmit in packages/solid.
  • Compiled store.type-tests.ts independently with strict TypeScript settings.
  • Ran the focused projection, store type, and server async tests: 184 tests passed.

@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5ceea76

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@solidjs/signals Patch
solid-js Patch
test-integration Patch
@solidjs/web Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
@solidjs/universal Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codspeed-hq

codspeed-hq Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 136 untouched benchmarks


Comparing GabbeV:fix/require-complete-store-seeds (5ceea76) with next (ff96a67)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant