Repository navigation
feat(website): generate API reference with the TypeScript 7.1 API - #346
Draft
jbergstroem wants to merge 2 commits into
Draft
jbergstroem wants to merge 2 commits into
jbergstroem wants to merge 2 commits into
Conversation
Try the 7.1 beta, which adds the programmatic API (typescript/async, typescript/ast and others). The existing build, typecheck, lint and tests pass unchanged, and the emitted declaration files are identical to 7.0.2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add a build step that reads the exports and JSDoc of each public package through the TypeScript 7.1 compiler API and writes two outputs: an HTML reference at /api/ and a plain-text version at llms/api.txt, linked from llms.txt. Public packages are the non-private ones with an index.ts at their root. The async API is used because typescript/sync depends on Node internals and does not run under Bun. The dev server now serves directory indexes and also watches the packages, so a JSDoc change rebuilds the docs. The shared CSS build moves into html.ts. Closes #105 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Why
The API reference was written by hand in each package README and could drift from the code. TypeScript 7.1 adds a programmatic compiler API, so the reference can be generated from the exported types and JSDoc that already exist in the source.
What
typescriptto7.1.0-beta. Build, typecheck, lint and tests pass unchanged, and the emitted.d.tsfiles are identical to 7.0.2.website/lib/api-docs.ts, a build step that reads each public package throughtypescript/asyncand extracts every export: kind, declaration, description, parameters, returns, throws and examples. Public packages are the non-private ones with anindex.tsat their root (core, js, sql, time-resolver; 51 exports)./api/(linked from the home page footer) and a plain-text version atllms/api.txt(linked fromllms.txt).extends. The printer's redundant| undefinedafter optional parameters is removed./api/) and also watchespackages/, so a JSDoc change rebuilds the docs.html.ts.Notes
typescript/asyncAPI may change before 7.1 is stable, which is why this is a draft. The version bump is its own commit and can be split out or held.typescript/synccrashes under Bun because it uses the Node-onlystdout._handle.fd.typescript/asyncworks under Bun and Node, so the generator uses the async API.llms/api.txtfile is run through oxfmt like the other llms files, which changes quote style and rewraps long unions. The HTML keeps the source as written.Closes #105