Skip to content

feat(kida): export child to build custom child signals - #250

Merged
dangreen merged 1 commit into
mainfrom
feat/kida-export-child
Sep 8, 2026
Merged

feat(kida): export child to build custom child signals#250
dangreen merged 1 commit into
mainfrom
feat/kida-export-child

Conversation

@dangreen

@dangreen dangreen commented Sep 8, 2026

Copy link
Copy Markdown
Member

Why

The Child Signals section of the store low-level page documents child($parent, key, setValue), but child lived only in packages/kida/src/internals and was not exported from kida or @nano_kit/store, so the documented import did not resolve. The public helpers built on it, atKey and atIndex, are exported and covered by the Advanced page; child is the primitive for custom writers.

What

  • packages/kida/src/child.ts re-exports internals/child.js, following lifecycle.ts, and index.ts exports it. @nano_kit/store picks it up through export * from 'kida'.
  • Docs: the dynamic key example types the key signal as signal<'a' | 'b'>('a'); child constrains the key to keyof P, so an Accessor<string> is rejected.

Checks

  • The three docs snippets were type-checked against the real @nano_kit/store exports, including the expected errors for an untyped key and for writing a readonly child.
  • oxlint, tsc --noEmit and vitest run (87 tests) in packages/kida pass; child keeps its own internals/child.spec.ts.
  • Sequential build of all packages and size-limit of every package that has it pass with unchanged limits: child was already bundled through atKey and atIndex.

`child` is the primitive behind `atKey` and `atIndex`: a signal for a property of a parent signal with a custom writer, writable when the parent is writable and a computed otherwise. The store docs describe it as public, but it lived only in `internals`, so `import { child } from '@nano_kit/store'` did not resolve. It is now exported from `kida`, and through it from `@nano_kit/store`. The docs example with a dynamic key types the key signal as the union of keys, which is what `child` requires.
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.33%. Comparing base (cb2d9e2) to head (9960193).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #250   +/-   ##
=======================================
  Coverage   83.33%   83.33%           
=======================================
  Files          98       98           
  Lines        2556     2556           
  Branches      551      551           
=======================================
  Hits         2130     2130           
  Misses        314      314           
  Partials      112      112           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dangreen
dangreen merged commit 8794697 into main Sep 8, 2026
10 checks passed
@dangreen
dangreen deleted the feat/kida-export-child branch September 8, 2026 16:59
@github-actions github-actions Bot mentioned this pull request Sep 8, 2026
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