Skip to content

Commit 75b90b9

Browse files
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

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build-desktop.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,6 @@ jobs:
273273
echo "has_signing_secrets=true" >> "$GITHUB_OUTPUT"
274274
fi
275275
276-
- name: Typecheck desktop and launcher
277-
run: pnpm exec turbo run typecheck --filter=@bb/desktop --filter=bb-app --output-logs=new-only
278-
279276
- name: Package x64 installer
280277
env:
281278
WIN_CSC_LINK: ${{ secrets.WINDOWS_CERTIFICATE_PFX }}

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ jobs:
120120
TURBO_CACHE_RESTORE_OUTCOME: ${{ steps.cache.outcome }}
121121
run: bash .github/actions/setup-workspace/install-dependencies.sh --ignore-scripts --filter bb --filter "@bb/process-utils..." --filter "@bb/host-workspace..." --filter "@bb/host-watcher..." --filter "@bb/agent-runtime..." --filter "@bb/provider-bridge-protocol..." --filter "@bb/provider-bridge-acp..." --filter "@bb/host-daemon-contract..." --filter "@bb/config..." --filter "@bb/db..." --filter "bb-plugin-provider-acp..." --filter "bb-plugin-provider-codex..." --filter "bb-plugin-provider-claude-code..." --filter "bb-plugin-echo-provider..." --filter "@bb/app..."
122122

123-
- name: Typecheck and test foundation packages
123+
- name: Lint and test foundation packages
124124
shell: bash
125-
run: pnpm exec turbo run lint typecheck test --filter=@bb/process-utils --filter=@bb/host-workspace --filter=@bb/host-watcher --filter=@bb/agent-runtime --filter=@bb/provider-bridge-protocol --filter=@bb/provider-bridge-acp --filter=@bb/host-daemon-contract --filter=@bb/config --filter=@bb/db --cache-dir="${TURBO_CACHE_DIR:-.turbo/cache}" --continue --concurrency=2 --output-logs=new-only --summarize
125+
run: pnpm exec turbo run lint test --filter=@bb/process-utils --filter=@bb/host-workspace --filter=@bb/host-watcher --filter=@bb/agent-runtime --filter=@bb/provider-bridge-protocol --filter=@bb/provider-bridge-acp --filter=@bb/host-daemon-contract --filter=@bb/config --filter=@bb/db --cache-dir="${TURBO_CACHE_DIR:-.turbo/cache}" --continue --concurrency=2 --output-logs=new-only --summarize
126126

127127
- name: Bound saved Turbo cache
128128
run: node scripts/prune-turbo-cache.mjs --dir .turbo/cache --max-size-mb 256 --keep-run-summaries .turbo/runs

‎.github/workflows/publish-bb-app.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,6 @@ jobs:
811811
echo "version=${NIGHTLY_VERSION}" >> "$GITHUB_OUTPUT"
812812
echo "Applied bb-app and desktop version ${NIGHTLY_VERSION}."
813813
814-
- name: Typecheck desktop and launcher
815-
run: pnpm exec turbo run typecheck --filter=@bb/desktop --filter=bb-app --output-logs=new-only
816-
817814
- name: Package x64 nightly installer
818815
# Signs when the Windows certificate secrets exist; without them the
819816
# installer is unsigned and Windows SmartScreen warns before running it.

‎apps/ai-gateway/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "wrangler dev",
88
"deploy": "wrangler deploy",
99
"test": "vitest run --config vitest.config.ts",
10-
"typecheck": "tsc --noEmit"
10+
"typecheck": "tsrs --noEmit"
1111
},
1212
"dependencies": {
1313
"@bb/connect-db": "workspace:*",
@@ -21,8 +21,8 @@
2121
"better-sqlite3": "12.10.0",
2222
"esbuild": "^0.28.1",
2323
"miniflare": "^4.20260701.0",
24+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
2425
"typescript": "npm:@typescript/typescript6@^6.0.2",
25-
"typescript-7": "npm:typescript@^7.0.2",
2626
"vitest": "^4.1.1",
2727
"wrangler": "^4.100.0"
2828
}

‎apps/app/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"storybook": "ladle serve",
1414
"storybook:build": "ladle build",
1515
"lint": "oxlint src vite.config.ts vite.dev.config.ts vite-bundle-stats.ts vite-font-preload.ts vite-split-prefetch.ts vite-forkable-plugin-paths.ts vite-shared-ui-seam.ts vite-react-compiler.ts",
16-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json",
16+
"typecheck": "tsrs --noEmit && tsrs --noEmit -p tsconfig.node.json",
1717
"test": "node scripts/generate-pwa-icons.mjs --check && vitest run --config vitest.config.ts",
1818
"bench": "cross-env BB_SIDEBAR_BENCH=1 PROMPTBOX_PERF=1 vitest run --config vitest.config.ts src/components/sidebar/sidebar.bench.test.tsx src/components/promptbox/editor/prompt-paste-performance.test.ts"
1919
},
@@ -137,8 +137,8 @@
137137
"remark-parse": "^11.0.0",
138138
"sharp": "^0.34.5",
139139
"tailwindcss": "^4.3.0",
140+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
140141
"typescript": "npm:@typescript/typescript6@^6.0.2",
141-
"typescript-7": "npm:typescript@^7.0.2",
142142
"unified": "^11.0.5",
143143
"vite": "^8.0.12"
144144
}

‎apps/app/src/lib/system-config-atoms.local-access.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ describe("local host daemon access atoms", () => {
157157
await store.get(localHostDaemonAccessStateAtom);
158158
expect(mocks.fetchSdkSystemConfig).not.toHaveBeenCalled();
159159
mocks.fetchSdkSystemConfig.mockImplementation(
160-
({ signal } = {}) =>
160+
({ signal }: { signal?: AbortSignal } = {}) =>
161161
new Promise((resolve) => {
162162
requests.push({ resolve });
163163
signal?.addEventListener(

‎apps/cli/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build": "node ../../scripts/build-node-entry.mjs src/index.ts dist/index.js --clean-dist --split",
1111
"start": "node dist/index.js",
1212
"clean": "rimraf dist",
13-
"typecheck": "tsc --noEmit",
13+
"typecheck": "tsrs --noEmit",
1414
"test": "vitest run"
1515
},
1616
"dependencies": {
@@ -41,7 +41,7 @@
4141
"@types/node": "^22.0.0",
4242
"esbuild": "^0.28.0",
4343
"tailwindcss": "^4.3.0",
44-
"typescript": "npm:@typescript/typescript6@^6.0.2",
45-
"typescript-7": "npm:typescript@^7.0.2"
44+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
45+
"typescript": "npm:@typescript/typescript6@^6.0.2"
4646
}
4747
}

‎apps/connect/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "wrangler dev",
88
"deploy": "wrangler deploy",
99
"test": "vitest run --config vitest.config.ts",
10-
"typecheck": "tsc --noEmit"
10+
"typecheck": "tsrs --noEmit"
1111
},
1212
"dependencies": {
1313
"@bb/connect-db": "workspace:*",
@@ -25,8 +25,8 @@
2525
"better-auth": "^1.6.23",
2626
"esbuild": "^0.28.1",
2727
"miniflare": "^4.20260701.0",
28+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
2829
"typescript": "npm:@typescript/typescript6@^6.0.2",
29-
"typescript-7": "npm:typescript@^7.0.2",
3030
"wrangler": "^4.100.0"
3131
}
3232
}

‎apps/demo-server/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "wrangler dev",
88
"deploy": "wrangler deploy",
9-
"typecheck": "tsc --noEmit",
9+
"typecheck": "tsrs --noEmit",
1010
"test": "vitest run --config vitest.config.ts",
1111
"build": "tsx scripts/build-assets.ts"
1212
},
@@ -22,6 +22,7 @@
2222
"@types/node": "^22.0.0",
2323
"bb-plugin-navigation": "workspace:*",
2424
"bb-plugin-thread-list": "workspace:*",
25+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
2526
"tsx": "^4.23.1",
2627
"typescript": "npm:@typescript/typescript6@^6.0.2",
2728
"vitest": "^4.1.1",

‎apps/desktop/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"smoke:browser-cdp": "node scripts/smoke-browser-cdp.mjs",
2828
"start": "pnpm run package && node scripts/run-packaged-app.mjs",
2929
"test": "install-electron && vitest run --config vitest.config.ts",
30-
"typecheck": "tsc --noEmit",
30+
"typecheck": "tsrs --noEmit",
3131
"smoke:browser-broker": "node scripts/smoke-browser-broker.mjs",
3232
"smoke:browser-address": "node scripts/smoke-browser-address.mjs"
3333
},
@@ -57,9 +57,9 @@
5757
"electron-builder-squirrel-windows": "26.15.7",
5858
"esbuild": "^0.28.0",
5959
"rimraf": "^6.1.0",
60+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
6061
"tsx": "^4.23.1",
6162
"typescript": "npm:@typescript/typescript6@^6.0.2",
62-
"typescript-7": "npm:typescript@^7.0.2",
6363
"vitest": "^4.1.1",
6464
"yaml": "^2.8.2"
6565
}

0 commit comments

Comments
 (0)