Skip to content

docs(index): export the referenced types and name IndexStateRow so the API tier renders them - #199

Closed
laithalsaadoon wants to merge 1 commit into
mainfrom
docs/index-doc-shapes
Closed

laithalsaadoon wants to merge 1 commit into
mainfrom
docs/index-doc-shapes

Conversation

@laithalsaadoon

Copy link
Copy Markdown
Contributor

What

Type-only and doc-comment-only changes in packages/index/src so TypeDoc can render @memhtml/index for the docs site's API tier. Four files, +15/-8. No runtime line changes, no tests touched.

  • index.ts: adds type exports for the five interfaces that exported signatures already reference: ArchivedMatch (SearchResult.archived), EmbedMissingOptions (IndexerShape.embedMissing), StoreChangedPath, StoreStatusEntry, StoreTreeEntry (StoreGitShape).
  • index-state.ts: IndexStateRow becomes type IndexStateRowShape = typeof IndexStateRow.Type; export interface IndexStateRow extends IndexStateRowShape {}, the pattern docs(html): name the six document shapes as interfaces so the API tier renders them #185 uses for the html shapes. Structurally identical; every import site compiles unchanged.
  • database.ts:297, indexer.ts:44,104,155,195,225: six {@link} targets that are module-private (runMigrations), closure-local (truncateForRebuild) or not on the package surface (EMBED_PERSIST_SLICE) become code spans. No value export was widened to satisfy a link.

Why

The next API-tier slice is packages/index (170 exports). Probed with the typedoc CLI and the site's settled options, the package's own contribution was 12 warnings (5 referenced-but-unexported types, 7 unresolved links) and 1 MDX brace hit (readIndexState's return type, IndexStateRow | undefined, inlined as an escaped literal). With this change and #185 both in place the page renders 0 warnings and 0 hits; measured on a worktree at #185's head with @memhtml/html resolved from source (artifacts logs typedoc-index-probe.log, typedoc-index-brace.log in the maintenance workspace). The remaining 13 hits under today's main are @memhtml/html's MemoryDoc alias inlined into the doc: parameters of the project.ts functions; #185 removes those and nothing in packages/index can.

This PR does not depend on #185: it compiles on main as is. The docs-site slice (astro.config.ts instance, api/index.md row, package README) follows as a separate PR once both are on main.

Boundary

Open-only: it touches packages/index/src, so it waits for Laith even though every change is a type or a comment. tsc -p packages/index/tsconfig.check.json and biome check pass; mise run check result is in the first comment.

…e API tier renders them

TypeDoc over packages/index/src/index.ts reported twelve warnings and one brace hit of its own
(the rest belong to @memhtml/html's aliases and go away with #185). Five interfaces were
referenced from exported signatures but not exported themselves (ArchivedMatch,
EmbedMissingOptions, StoreChangedPath, StoreStatusEntry, StoreTreeEntry): they join the
package's type exports. Six {@link}s pointed at module-private or closure-local names
(runMigrations, truncateForRebuild x4, EMBED_PERSIST_SLICE) that no reader can follow: they
become code spans. IndexStateRow was `export type X = typeof X.Type`, which TypeDoc inlines as
a literal in readIndexState's return type; as an interface extending the same Schema.Struct
type it renders as a linked reference, the pattern #185 uses for the html shapes.

Type-only and doc-comment-only; no runtime line changes. tsc and biome pass on the package.
@laithalsaadoon

Copy link
Copy Markdown
Contributor Author

Local gate on ac0afd5: mise run check exit 0, 68/68 tasks, 3m21s (2026-09-16 07:24Z). Open-only per the maintenance rules (packages/index/src); not merging.

Copilot AI lite review requested due to automatic review settings September 16, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@laithalsaadoon
laithalsaadoon requested a lite review from Copilot September 16, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@laithalsaadoon

Copy link
Copy Markdown
Contributor Author

Closed in favor of #264, which consolidates the four API-tier PRs (#185 html document shapes, #186 the @memhtml/html API page, #199 index types, #201 sleep types) into one branch built by merge commits from main a1c6913. The slice conflict on apps/docs/astro.config.ts and api/index.md was resolved by appending the html block after llm; the block is byte-identical to #186's. Gate 68/68, including the docs build that writes /api/html/ and the MDX brace probe. The branch here is kept, so this PR can be reopened if the parts should land apart.

laithalsaadoon added a commit that referenced this pull request Oct 20, 2026
… @memhtml/html to it (#264)

Three type-only edits under `packages/*/src` plus the `@memhtml/html` API page. No runtime line changes: the emitted JavaScript is identical.

What changes:
- `packages/html/src/document.ts`: the six document shapes (`MemoryMetas`, `MemoryLink`, `Facet`, `Citation`, `ArticleExtractions`, `MemoryDoc`) become interfaces that extend `typeof X.Type`, so the const and the interface merge under one name and every import site compiles unchanged.
- `@memhtml/html` API page: a `starlightTypeDoc` instance writes `/api/html/` from the package's single import path; a new `packages/html/README.md` opens the page; the tier index gains a row and the sidebar a group.
- `packages/index/src`: `type` exports for five interfaces that exported signatures already reference (`ArchivedMatch`, `EmbedMissingOptions`, `StoreChangedPath`, `StoreStatusEntry`, `StoreTreeEntry`); `IndexStateRow` becomes an interface the same way as the html shapes; six `{@link}`s to private names become code spans.

Why: typedoc expands a `typeof X.Type` alias inline wherever a signature uses it, and typedoc-plugin-markdown prints an inline object literal inside a type argument as escaped `\{` prose, which `apps/docs/tests/figures.test.ts` rejects. The interfaces and named types render as links instead. Measured with the typedoc CLI: html went from 7 brace hits and 6 warnings to 0 and 0; index from 12 warnings and 1 hit (plus 13 hits from html's aliases) to 0 and 0. With these on main, the index API page (`/api/index/`) can follow as a docs-only slice.

One caveat: an interface does not get the implicit index signature an object-literal type alias gets, so an out-of-tree consumer that assigned a `MemoryDoc` or an `IndexStateRow` to `Record<string, unknown>` would stop compiling. The workspace typecheck finds no such site.

Consolidates #185, #186, #199 and #201, closed in favor of this branch. The `packages/sleep` part of the original branch no longer applies: 0.16.0 removed that package.
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.

2 participants