Repository navigation
docs(html): name the six document shapes as interfaces so the API tier renders them - #185
Closed
laithalsaadoon wants to merge 1 commit into
Closed
laithalsaadoon wants to merge 1 commit into
laithalsaadoon wants to merge 1 commit into
Conversation
…r renders them
MemoryMetas, MemoryLink, Facet, Citation, ArticleExtractions and MemoryDoc
were `export type X = typeof X.Type` aliases. TypeDoc expanded each inline
wherever a signature used it, and typedoc-plugin-markdown rendered the nested
literals as escaped braces (7 hits across metaPairs, serializeMemory and
parseMemory) that the figures probe rejects; the 6 {@link MemoryMetas.status}
references also failed to resolve against the const. As interfaces extending
the same Schema.Struct type the const and the type merge under one name, every
import site compiles unchanged, and the page renders 0 hits and 0 warnings.
Type-only; no runtime line changes. mise run check 68/68.
This was referenced Sep 14, 2026
Closed
Contributor
Author
|
Closed in favor of #264, which consolidates the four API-tier PRs (#185 html document shapes, #186 the |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type-only change in
packages/html/src/document.ts, opened for review and left unmerged: it sits underpackages/*/src, so it is outside the maintenance job's merge authority even though no runtime line changes.What changes
The six document shapes (
MemoryMetas,MemoryLink,Facet,Citation,ArticleExtractions,MemoryDoc) were declared asexport type X = typeof X.Type. Each is now an interface that extends that same type:The const and the interface merge under one name, so every import site keeps compiling unchanged.
mise run checkon the branch is green (typecheck across the workspace, lint, every test tier).Why
The API tier (
/api/<package>/on the docs site, generated by typedoc) is about to add@memhtml/html. With the aliases, TypeDoc expands the shape inline wherever a signature uses it, and typedoc-plugin-markdown renders the nestedarticleandmetasliterals as escaped\{prose, whichapps/docs/tests/figures.test.tsrejects. Measured with the typedoc CLI on26480c7: 7 brace hits (metaPairs,serializeMemory,parseMemory) and 6 warnings for{@link MemoryMetas.status}, which cannot resolve against aconst. With the interfaces: 0 hits, 0 warnings, andparseMemoryrenders asEffect<MemoryDoc, InvalidMemory>withMemoryDoca link. The same pattern was used for@memhtml/llmin #170.One caveat to weigh
An interface does not get the implicit index signature an object-literal type alias gets, so a consumer that assigned a
MemoryDoctoRecord<string, unknown>would stop compiling. The workspace typecheck found no such site; an out-of-tree consumer might.The docs slice that depends on this is opened separately with this branch as its base.