Repository navigation
Commit 75b90b9
Typecheck with tsrs instead of TypeScript 7 tsc (#5861)
## Human comments
## What was wrong
Typechecking ran on TypeScript 7.0.2 (`typescript-7` →
`npm:typescript@^7.0.2`).
[tsrs](https://blog.cloudflare.com/typescript-rust-port), the Rust port
of the TypeScript 7 compiler, is roughly twice as fast and uses half the
memory on bb (numbers below). This PR moves bb's typechecking to it.
tsrs 0.18.0 is a faithful port of TypeScript `7.1.0-dev.20260930.4` and
prints the same diagnostics. Moving to it therefore also moves bb onto a
7.1 nightly, which brings two upstream regressions. tsrs also has no
Windows binary yet:
1. **TS5115 on zod's `z.json()`** ("Instantiations of the following
types appear infinitely circular: 'IsOptionalIn', '$ZodTypeInternals',
'$InferZodRecordInput'"). Reported as microsoft/TypeScript#64605. The
first nightly that fails is `7.1.0-dev.20260929.1`, after
microsoft/TypeScript#64372.
2. **TS7031 on a contextually typed destructured parameter with `=
{}`.** Reported as microsoft/TypeScript#64431, with fixes proposed in
microsoft/TypeScript#64440 and microsoft/TypeScript#64671. The first
nightly that fails is `7.1.0-dev.20260923.1`.
3. **No `win32-x64` package through 0.18.0.** tsrs's `npm/README.md`
says its release workflow now builds one. Intel Macs remain unsupported.
## What changed
- **tsrs replaces TypeScript 7 for typechecking.** Every `package.json`
that listed `typescript-7` now lists `tsrs` pinned to
`0.18.0-ts7.1.0-dev.20260929` (exact pin because the releases are
experimental), and every `typecheck` script runs `tsrs --noEmit`.
`typescript` (the `@typescript/typescript6` JS API) stays for tooling
that imports it.
- **Workaround for regression 1.** Core code uses
`jsonValueSchema`/`jsonObjectSchema` from `@bb/domain` instead of
`z.json()`: `apps/desktop` (CDP + capture, plus two tests) and
`packages/desktop-contract`. Forkable plugins can't import `@bb/domain`,
so account-pool, bb-account, connect, mcp and workflows each define the
same `z.lazy` schema, typed with the SDK's `JsonValue`. That schema has
the same structure as zod's `z.json()`, so runtime validation is
unchanged. The only remaining `z.json()` calls are in two tests that
don't trigger the error.
- **Workaround for regression 2.** The abort-signal mock in
`system-config-atoms.local-access.test.ts` annotates its parameter.
- **Windows.** The `windows-foundation` job now runs `lint test` without
`typecheck`. The Windows typecheck steps in `build-desktop.yml` and the
`nightly-desktop-windows` job are removed.
`plugin-authoring-doc-examples.test.ts` now launches tsrs and skips on
win32. Types don't depend on the OS, and the Linux `static-checks` job
still typechecks every package. These can come back once tsrs publishes
`win32-x64`.
- Left alone: the plugin scaffold's `typescript` dependency for user
plugins, and the bb-app tarball smoke test's `npx typescript` consumer
check. Both stand in for what plugin authors and SDK users run.
## How you verified
- `pnpm exec turbo run typecheck --force --continue` on tsrs: 105/105
pass. Before the workarounds, 7 failed, with 16 TS5115 errors and 1
TS7031.
- Every changed package also passes `tsc --noEmit` on TypeScript 7.0.2.
- Both regressions reproduce on tsc `7.1.0-dev.20260930.4` and today's
`7.1.0-dev.20261020.3`, and pass on 7.0.2. I found the first failing
nightly for each by trying successive builds.
- `turbo run lint test` for `@bb/desktop`, `@bb/desktop-contract`,
account-pool, bb-account, connect, bb--mcp and workflows: 16/16 pass.
The doc-examples test passes with tsrs, and the system-config atoms test
passes (12/12).
- Speed, same machine, warm, `--noEmit`, best of two runs:
| package | tsc (TS 7.0.2) | tsrs |
|---|---|---|
| `apps/server` | 11.3s, 3.3 GB | 5.5s, 1.6 GB |
| `apps/app` | 11.4s, 3.4 GB | 6.4s, 1.7 GB |
- `pnpm install --frozen-lockfile` is clean, and `oxfmt --check` passes.
> AGENT GENERATED
---------
Co-authored-by: Sawyer <[email protected]>1 parent 501d33b commit 75b90b9
118 files changed
Lines changed: 701 additions & 682 deletions
File tree
- .github/workflows
- apps
- ai-gateway
- app
- src/lib
- cli
- connect
- demo-server
- desktop
- src
- test
- fixtures
- host-daemon
- mobile
- server
- test/services/plugins
- web
- examples/plugins
- composer-customization
- echo-provider
- replacement-lab-alpha
- replacement-lab-beta
- thread-chat-demo
- packages
- agent-runtime
- bb-app
- client-core
- config
- connect-client
- connect-db
- core-ui
- db
- desktop-contract
- src
- domain
- environment-provider-host
- fuzzy-match
- hono-typed-routes
- host-daemon-contract
- host-watcher
- host-workspace
- local-open-targets
- logger
- mobile-bridge
- plugin-build
- plugin-registry
- plugin-sdk
- process-utils
- provider-bridge-acp
- provider-bridge-protocol
- provider-parity
- scripts
- sdk
- secret-storage
- server-archive
- server-contract
- templates
- test-helpers
- text-utils
- thread-view
- tunnel-client
- tunnel-contract
- plugins
- account-pool
- src
- agent-annotations
- ask-user-question
- automations
- bb-account
- src
- bb-ai
- bb-guide
- browser-automation
- concurrency-limit
- connect
- src
- custom-instructions
- docs
- drafts
- environment-git-worktree
- environment-modal-sandbox
- environment-personal-workspace
- environment-project-checkout
- github
- inline-vis
- keep-awake
- mcp
- src
- memory
- monaco-editor
- pdf-preview
- plugin-api-docs
- plugin-api-tester
- prompt-library
- provider-acp
- provider-claude-code
- provider-codex
- provider-pi
- provider-retry
- provider-usage
- push-notifications
- scheduled-send
- secrets
- side-chat
- storage-retention
- tasks
- theme-preview
- thread-list
- workflows
- src
- tests
- integration
- qa
- scripted-echo-provider
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | 276 | | |
280 | 277 | | |
281 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | 814 | | |
818 | 815 | | |
819 | 816 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | | - | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | | - | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
0 commit comments