Skip to content

chore: upgrade typecheck to TypeScript 7.0.2 - #56300

Merged
kitlangton merged 3 commits into
devfrom
typescript-7-upgrade
Oct 17, 2026
Merged

kitlangton merged 3 commits into
devfrom
typescript-7-upgrade

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Moves type checking off the December @typescript/native-preview dev build (7.0.0-dev.20251207.1) and onto the TypeScript 7.0.2 release.

Layout

TypeScript 7.0 ships a native tsc but no JavaScript compiler API, so this uses the side-by-side setup from the 7.0 release notes:

  • @typescript/native → npm:typescript@7.0.2 provides tsc. Every typecheck script now runs tsc instead of tsgo, and the bun tsc -p tsconfig.build.json library builds use it too.
  • typescript → npm:@typescript/typescript6@6.0.2 (exposes tsc6) for code that imports the compiler API: Astro check, script/sdk-docs.ts, and similar tools. Before this change they got 5.8.2.

packages/desktop moves from its own typescript@~5.6.2 to the catalog entry, because its tsc binary would otherwise collide with TS 7's. sdks/vscode and github/ are outside the workspace and keep their own pinned versions. The root package gains @types/bun for the root and packages/containers configs.

TS 6/7 default changes

  • types now defaults to []: added "types": ["bun"] to the Bun-based tsconfigs that relied on implicitly visible @types. packages/app gets ["bun", "node"], matching what was visible before. http-recorder sources get ["node"] and its tests get ["bun"].
  • rootDir no longer inferred: packages/app includes ../storybook/playwright/*.ts, so it now sets "rootDir": "..", the root that used to be inferred. The no-emit app/e2e config widens to ../.. for the same reason.
  • noUncheckedSideEffectImports now defaults to true: a session-ui perf fixture imports @opencode/ui/styles CSS through package exports that don't end in .css, so those two specifiers get an ambient declaration. The check stays on.

Code fixes from stricter inference

  • core/database/migration.ts: restoreForeignKeys was a union of SQLiteEffectRaw<…> and Effect<void>. TS 7.0.2 no longer resolves .pipe(Effect.orDie) on that union, which left the database layer's requirements as unknown. Both branches are now Effect<void> via Effect.asVoid. No runtime change.
  • script/profile-typecheck.ts now counts tsc processes instead of tsgo.
  • tui/terminal-pane.tsx: send takes Uint8Array<ArrayBuffer>, the type interactionFrame actually returns, to satisfy DOM WebSocket.send's BufferSource.

Verification

  • Every workspace typecheck passes, same as dev. On this host the Astro checks need Bun as the runtime because Node is old (bun --bun x astro check); posts and www pass under TS 6.0.3.
  • bun run lint passes, including sdk-docs on the TS 6 API.
  • bun turbo build --filter='@opencode/cli^...' --filter='@opencode/app^...' passes: 3m08s on dev, 38s here, sequential on the same machine. The emitted .d.ts keep the same file set. Diffs are member order and type printing, and any occurrences drop (for example, ai 437 → 137, core 228 → 159).
  • bun test test/database-migration.test.ts test/database.test.ts in core: 22 pass.
  • app typecheck:e2e has the same 4 errors it already has on dev.

Requested by: @kitlangton (Kit via Slack)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as described. On the PR head, typecheck passes in core, tui, app, session-ui, cli, plugin, ui, desktop, server and sdk. The core database migration tests (22 pass), the core build and bun run lint (including sdk-docs on the TS 6 API) also pass, and nothing still refers to tsgo or native-preview. These checks were not rerun on the base for comparison.

Public API is unchanged. This is dev tooling and tsconfig only, plus two type-only code tweaks with no runtime change.

One thing to be aware of: packages/desktop depends on both its own typescript ~5.6.2 and @typescript/native, and both provide a tsc command. Bun linked the 7.0.2 one, so its tsc -b currently runs TS 7.0.2 and passes. That relies on which package wins the command clash, and it doesn't match the description's "keeps its own pinned typescript" for type checking. If 7.0.2 is the one you want there, dropping or aligning desktop's own typescript pin would remove the ambiguity.

Related: #49224

Replace the December @typescript/native-preview dev build with the TypeScript 7.0.2 release using the side-by-side layout from the 7.0 release notes: @typescript/native provides the native tsc, and typescript resolves to @typescript/typescript6 for tools that need the JavaScript compiler API.
Give the root and containers configs @types/bun, keep desktop's typescript on the catalog so tsc resolves to TypeScript 7 only, declare the CSS package exports instead of disabling noUncheckedSideEffectImports, scope http-recorder's src types to node, and point the typecheck profiler at tsc.
oxlint ignores .d.ts files, so a change touching only declaration files made it print a plain-text message that lint:changed then failed to parse as JSON.
@opencode-agent
opencode-agent Bot force-pushed the typescript-7-upgrade branch from 0b14827 to 3e10b3f Compare October 17, 2026 14:58
@kitlangton
kitlangton merged commit 23359e9 into dev Oct 17, 2026
20 checks passed
@kitlangton
kitlangton deleted the typescript-7-upgrade branch October 17, 2026 20:26
floris3456 added a commit to floris3456/OpenCodePlus that referenced this pull request Oct 19, 2026
Merges anomalyco/opencode `dev` at 501b15a ("docs: point README install
methods at V2", 2026-10-18). Upstream promoted V2 to `dev` on 2026-10-10
(5caf1f9); `v2` stays frozen at 4617210, the previous merge base.
64 files conflicted.

Resolution rules:
- Typecheck moves to TypeScript 7 (`tsc`, `@typescript/native`, anomalyco#56300),
  including the Plus-only `plus` and `cliproxyapi` packages; their test
  config roots at `packages/` because TypeScript 7 enforces `rootDir`.
- Test scripts keep our `--parallel` runs and timings and add upstream's
  flags (`--timeout=30000`).
- Config watching keeps our service-wide-only policy (no per-folder
  watchers) and adds upstream's system config directory, configured
  `instructions` entries and remote instruction URLs.
- Config file references keep our managed-placement reader: a placed config
  still fails closed on a reference it cannot read, a local one now
  substitutes empty with a warning, as upstream intends.
- `SessionGenerate.generate` keeps our observation and warming path without
  upstream's `ModelRetry`: warming has its own retry, and a retry inside the
  observed call would put several wire requests under one invocation.
  Upstream's retry test for that path is left out.
- Plugin host and APIs keep `config.reload` and add upstream's
  `credential.activate`, `session.list` and `permission.assert`.
- The updater keeps the OpenCodePlus installer method first and adds WinGet;
  the service port keeps the Plus channel and adds the Windows port shift.
- The CLI build keeps our build-identity refactor and adds release
  highlights and the native-architecture check.
- The TUI update dialog takes upstream's new layout with our product-aware
  wording; footer hints follow upstream's action-then-key order.
- `@modelcontextprotocol/sdk` keeps sharing the catalog `zod`.
- `packages/cli/package.json` dependency keys stay in bun canonical order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant