Repository navigation
Let runtime and package modules be TypeScript, compiled to the JavaScript pages load - #7424
Merged
Merged
Conversation
…ript pages load A module may now be written as name.ts beside the name.js the layer serves. build/typescript.mjs strips the types (erasable syntax only) and formats the result with oxfmt, and the tree commits the output, so installs from git, pages, tests and the kernel compiler still read JavaScript and nothing on a user's machine compiles. This reverses the build's refusal of TypeScript under the runtime: an edit to a .ts module now needs node build/typescript.mjs (also run by a pre-commit hook) before it reaches a page. - build: typescript.mjs writes and checks each output, and check:browser refuses a stale one or one whose source is gone. - browser/types: the strict type check reads .ts modules, preferring a .ts over its compiled .js. - layer: a layer composes no .ts, so pages neither load nor copy sources. - knip reads the compiled .js in a module's place, as eslint and dependency-cruiser already do. - runtime/state/tab-store is the first module in TypeScript. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWabEKzt7s5HiW4koa7
… hook - oxfmt.config.ts replaces .oxfmtrc.jsonc, so the TypeScript build imports the formatter's settings rather than parsing JSONC; Dependabot leaves oxfmt to move with the pre-commit hook's pin. - The serving runtime's file reader composes no .ts either (runtime_selection). - The compile hook wakes on .ts sources and the build's own inputs only. - The type check reads every .ts the compiler compiles. - check:browser and the compiler share one finder of stale compiled modules. - The install section points at build/AGENTS.md rather than restating it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWabEKzt7s5HiW4koa7
leaf-agent
approved these changes
Nov 27, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 27, 2026
<!-- claude-projects-attribution: {"github_login":"max-sixty"} -->
_Requested by **Maximilian** · [project
thread](https://claude.ai/code/project/chan_01HAT2svakg1fTA5kitqhX9w?thread=cmsg_01HAT2svakg1fTA5kitqhX9wERfAJinBvZtiP4jvQpWkPy)_
Converts 86 runtime modules to TypeScript on the infrastructure from
#7424: all of `runtime/state`, `runtime/transport` and `runtime/base`,
and `runtime/lib` apart from the eight modules the Effect UI port is
reworking (leaf-element, controls, widget-events, failure, pending-task,
time-axis, icons, frame-pass) and the generated `syntax-languages.js`.
Each `.ts` sits beside the `.js` the layer serves, which
`build/typescript.mjs` compiles from it. JSDoc types became TypeScript
types, `@typedef`s became `type` declarations (exported only where
another file names them), casts became `as`, and inline `import("…")`
types became `import type`.
**What runs doesn't change.** Parsed without comments, every compiled
`.js` is the same program as the JavaScript it replaces, except
`transport/layer-client.js`: `RequestError` now declares its four
fields, which its constructor already assigned.
Other changes:
- knip takes each TypeScript module as an entry, so the types only a
`.ts` uses count as used. A side effect: knip doesn't report an exported
type in a `.ts` that nothing imports. Value exports are still checked
through the compiled `.js`.
- The keydown-listener register test now counts `base/field-keys.js`,
whose listener a JSDoc cast had hidden from the parse.
- The Worker build's two tests type-check in a project of their own,
`worker/tsconfig.node.json`, with the DOM's and Node's types: the build
imports `state/widget-imports`, whose TypeScript is written for the DOM,
and the DOM's types clash with the Workers runtime's in
`worker/tsconfig.json`. `check:worker` runs both.
- `check:browser` names a compiled `.js` that differs from what its
`.ts` compiles to apart from stale output, and asks for the change to
move into the `.ts` first: a merge from a branch that predates the `.ts`
can bring one, and a plain rebuild would drop it. `build/AGENTS.md` says
the same. Merging main carried #7426's `document-inputs` change into the
`.ts` this way.
- The package references say a TypeScript library module keeps its types
in the `.ts` beside the `.js` a widget imports.
Checks: `tsc` over `browser/types/tsconfig.json` and both Worker
projects, `check:browser`, `test:worker`, `test:runtime` (1197 pass) and
every pre-commit hook on the changed files.
https://claude.ai/code/session_01V22NWabEKzt7s5HiW4koa7
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <[email protected]>
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.
Requested by Maximilian · project thread
A runtime or bundled-package module may now be written as
name.ts, beside thename.jsthe layer serves. The tree commits that.js, so installs from git, pages, tests and the kernel compiler still read JavaScript. Nothing on a user's machine compiles, and package authors still write plain JavaScript with no build.This PR is the infrastructure, with one module (
runtime/state/tab-store) converted as a pilot. Converting the runtime by directory follows in separate PRs, and Effect UI ports are written in.tsonce this lands.How it works
build/typescript.mjs): strip the types withnode:module'sstripTypeScriptTypes, so sources may use only erasable syntax (already required byerasableSyntaxOnly). Then format the result with oxfmt and the repo's settings..tsline..jsnames its source.check:browserrefuses an output that is stale or whose source is gone, and the build removes the latter.browser/types/tsconfig.jsonreads every.ts. When a.tsand a.jsshare a base name, tsc keeps the.ts.layer.composed()drops.tsfrom what a layer composes and from what the serving runtime reads (runtime_selection), so a page neither loads nor copies sources. A model test covers both..oxfmtrc.jsoncbecomesoxfmt.config.ts, which the compiler imports. The pre-commit hook andpackage.jsonpin the same oxfmt version, and Dependabot leaves oxfmt alone, as it already does for esbuild and Rolldown..tsor one of the build's own inputs changes.A rule this reverses
checkRuntimeModulesrefused.tsunder the runtime "so an edit reaches pages and tests without a build". An edit to a.tsmodule now reaches them only afternode build/typescript.mjsruns, which the pre-commit hook does. Hand-written.jsmodules still need no build. RootAGENTS.md,build/AGENTS.mdandbrowser/AGENTS.mdnow say this.Checks
check:browser,check:tools,test:browserandtest:runtimepass, as dotests/model(one failure, a permission test that fails when run as root) and pre-commit on the changed files. An independent review found 11 issues, all fixed here.Generated by Claude Code