Skip to content

docs(useMap): mark initialState as optional - #578

Open
mmporong wants to merge 1 commit into
toss:mainfrom
mmporong:docs/usemap-optional-initial-state
Open

mmporong wants to merge 1 commit into
toss:mainfrom
mmporong:docs/usemap-optional-initial-state

Conversation

@mmporong

Copy link
Copy Markdown

Overview

useMap defaults initialState to new Map(), and useMap.spec.ts already calls useMap() with no argument. The JSDoc still listed it as required:

 * @param {MapOrEntries<K, V>} initialState - Initial Map state (Map object or array of key-value pairs)

So the generated page, its ko/ja/es/zh-Hans translations and the agent skill reference all show initialState as required, and their signature has no default.

This PR documents it as [initialState=new Map()], the same way useSet documents its initialState ([initialState=new Set()]). It then regenerates useMap.md and packages/plugin/skills/react-simplikit/references/useMap.md, and updates the four translations the same way: the required flag is dropped and the signature reads initialState: MapOrEntries<K, V> = new Map(), as on the useSet pages. A patch changeset is included, following #569.

How it was checked:

  • A TypeScript-checker script compared every documented export's @param optional marker with its signature. On main, useMap's initialState was the only mismatch among 42 functions. On this branch there are none.
  • The English page and the skill copy come from the repo's generateDocs (the code behind yarn docs:gen useMap, which also runs generateSkill). yarn install could not finish on this machine, so the generator files were transpiled with the repo's TypeScript and run under PnP instead of tsx. A control run on unchanged main reproduced the committed files exactly.
  • .scripts/verifyDocs.ts and .scripts/verifySkill.ts pass the same way. As a negative check, verifyDocs fails with "useMap.md is out of date" when only the JSDoc is changed.
  • prettier --list-different on the changed files reports nothing.
  • Not run: yarn run fix (ESLint), yarn run test:coverage and verifyDocsI18n. No code changed, so no new test.

The investigation and the change were done with Claude Code (Claude Opus 5.5).

Checklist

  • Did you write the test code?
  • Have you run yarn run fix to format and lint the code and docs?
  • Have you run yarn run test:coverage to make sure there is no uncovered line?
  • Did you write the JSDoc?

useMap defaults initialState to new Map(), and useMap.spec.ts already calls
it with no argument, but the JSDoc listed initialState as required, so the
generated docs, the translations and the agent skill reference all marked
it required. Document it as [initialState=new Map()], the way useSet
documents its initialState, and regenerate the docs and the skill copy.

Assisted-by: Claude:claude-opus-5-5
@changeset-bot

changeset-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 795332e

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

This PR includes changesets to release 1 package
Name Type
react-simplikit 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

This branch has not been deployed

No deployments
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