Repository navigation
Type-check leaf.js and package widgets, and ship no declaration file in pages - #2850
Merged
Merged
Conversation
…in pages `check:browser`'s non-strict program now covers `leaf.js`, the kernel's `widgets/`, and every bundled package's `initial.js` and widget modules, beside the runtime modules and render checks it already checked. The framework's types no longer reach the check through a generated `vendor/browser-runtime.d.ts`, which `leaf page init` copied into every page's `vendor/`. Instead both programs share one `paths` map in `build/browser/tsconfig.json` (the runtime program extends it), which resolves the rooted paths a page serves, including each package's `vendor/` and `widgets/`, and maps `/vendor/browser-runtime.js` to `index.ts`. Runtime modules now import the facade by that served path, as `layer_import_map` already says every layer module names its dependencies; a relative path would reach the compiled, type-blanked facade. The build no longer writes the declaration file. What the wider check found: - Dead wiring: `leaf.js` passed `foldMarginEntryOptions` and `unfoldedMarginEntries` to `createReactionController`, which stopped reading them in #2753 (the overlay no longer exports them either). Removed, with the stale field in `tests/runtime/reactions.test.mjs`. - `claimTraversals` declared that a claim receives a string; it receives the traversal's `URL`. `readDiffCoordinate` now declares the coordinate it returns. - `lf-trace` used `peer?.#bookmarks`, which tsc refuses as a grammar error; it reads `peer && peer.#bookmarks` now. - Web Awesome's `wa-comparison` and `wa-radio` declarations join the program, so `offer` and `createElement` type those controls. The rest are JSDoc casts and parameter types. No behavior changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The type check maps only the facade's served path to the framework's source; a relative path reaches the compiled facade, whose types are blanked, so what a module imported through it went unchecked. The runtime's ESLint ownership rule now reports one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 14, 2026
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.
pnpm run check:browsernow type-checksleaf.js, the kernel'swidgets/, and every bundled package'sinitial.jsand widget modules under the same non-strictcheckJsprogram #2803 added for the runtime. Pages no longer carryvendor/browser-runtime.d.ts: the build stops generating it, and a freshly vendored page (leaf page init --package diff --package playwright) has no.d.tsfile.How the framework's types reach the check now
The generated declaration file sat beside
vendor/browser-runtime.jsso that tsc would prefer it over the compiled, type-blanked facade. Since it lived in the layer'svendor/,leaf page initcopied it into every page. Instead:build/browser/tsconfig.jsonholds onepathsmap, whichtsconfig.runtime.jsonnowextends. It resolves the rooted paths a page serves, including each package'svendor/andwidgets/, and maps/vendor/browser-runtime.jstoindex.ts.pathsapplies only to non-relative specifiers, so the 39 runtime modules (andleaf.js) that imported the facade as../vendor/browser-runtime.jsnow import/vendor/browser-runtime.js. That was already the convention: four runtime modules used it, andlayer_import_mapsays every layer module names its dependencies by rooted path. The import map, export, kernel bundle and Node test hooks all resolve it already, and a probe ofpr-walkthroughboots with no errors.semanticStoreOwnershipRule) now refuses one, with a test inbuild/browser/architecture.test.mjs.vendor/as well as the layer's.What the wider check found
leaf.jspassedfoldMarginEntryOptionsandunfoldedMarginEntriestocreateReactionController, which stopped reading them in fix: restore margin folds after reaction choices close #2753; the overlay no longer exports either, so both were alwaysundefined. Removed, with the stale field intests/runtime/reactions.test.mjs.claimTraversalsdeclared that a claim receives a string, but it receives the traversal'sURL(lf-tabsreadsurl.hash).readDiffCoordinatenow declares the coordinate it returns.lf-traceusedpeer?.#bookmarks. tsc refuses that as a grammar error (TS18030), which stopped the whole program, so it now readspeer && peer.#bookmarks.wa-comparisonandwa-radiodeclarations join the program, sooffer()andcreateElementtype those controls.The rest are JSDoc casts and parameter types. I found no behavior bug.
Checks
pnpm run check:framework(browser build check, including both type programs, plus 110 Node tests) andpnpm run test:runtime(470 tests) pass. Focused pytest ontest_unused_exports.py,test_interact_document.py,test_interact_layer.py,test_distribution.pyandtest_module_url_delivery.pypasses (440 tests), as does pre-commit, including ESLint over every runtime module. An error injected into a package widget failscheck:browser.