Skip to content

chore(typescript): adopt TypeScript 7.0 (tsgo) for cowswap-frontend typecheck - #7907

Draft
tenderdeve wants to merge 4 commits into
cowprotocol:developfrom
tenderdeve:feat/7827-typescript-native-preview
Draft

tenderdeve wants to merge 4 commits into
cowprotocol:developfrom
tenderdeve:feat/7827-typescript-native-preview

Conversation

@tenderdeve

@tenderdeve tenderdeve commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

First step toward #7827.

TypeScript 7.0 ships a native compiler (tsgo, @typescript/native-preview) that's type-check compatible with tsc and ~10x faster.

  • Add @typescript/native-preview as a dev dependency (pinned).
  • Switch the cowswap-frontend typecheck target from tsc to tsgo — it type-checks cleanly under the native compiler (0 errors).
  • Add docs/typescript-7-migration.md: how to run tsgo, per-project status, and the rollout plan.

Kept incremental on purpose: tsc stays installed and in use everywhere tsgo hasn't been rolled out. Repo-wide adoption is gated on #7828 — the remaining libs don't type-check cleanly yet, so they stay on tsc until fixed. I'll flip each project to tsgo as it's verified (ui is already fixed in #7905).

@kernelwhisperer as discussed on #7879.

Summary by CodeRabbit

  • Tooling

    • Updated the frontend type-checking command to use TypeScript’s native Go-based compiler preview.
    • Added the TypeScript native preview package for development.
  • Documentation

    • Added migration guidance, usage examples, rollout status, and known prerequisites for adopting the new compiler across projects.

…ypecheck

Start the TypeScript 7.0 migration (cowprotocol#7827). The native compiler (tsgo) is
type-check compatible with tsc and ~10x faster.

- Add @typescript/native-preview as a dev dependency.
- Switch the cowswap-frontend typecheck target to tsgo (it type-checks cleanly).
- Add docs/typescript-7-migration.md documenting the approach, how to run tsgo,
  and per-project status.

Repo-wide rollout is gated on cowprotocol#7828; the remaining libs don't type-check cleanly
yet, so they stay on tsc until fixed. Each project is switched to tsgo as it's
verified.
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@tenderdeve is attempting to deploy a commit to the cow-dev Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d3de170-79be-4b30-b674-ce3e08456217

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The repository adds the TypeScript native preview compiler, documents its incremental migration, and changes the cowswap frontend typecheck target from tsc to tsgo.

Changes

TypeScript 7 rollout

Layer / File(s) Summary
Native compiler setup and migration guidance
package.json, docs/typescript-7-migration.md
Adds the pinned @typescript/native-preview development dependency and documents tsgo usage, migration status, and remaining adoption work.
Cowswap frontend typecheck switch
apps/cowswap-frontend/project.json
Updates the frontend typecheck command to run tsgo --noEmit with its existing project configuration.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: kernelwhisperer, shoom3301, alfetopito

Poem

A bunny hops where type checks grow,
From trusty tsc to speedy tsgo.
With docs in hand and tools aligned,
The frontend leaves old checks behind.
“Hop, hop!” says Bun, “the types all glow!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: switching cowswap-frontend typecheck to TypeScript 7 tsgo.
Description check ✅ Passed The description covers the migration summary, rollout plan, and background well enough for review.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​typescript/​native-preview@​7.0.0-dev.20260707.21001008299100

View full report

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swap-dev Ready Ready Preview Jul 27, 2026 12:59pm

Request Review

@kernelwhisperer kernelwhisperer added the On_hold There's unresolved blockers. label Jul 28, 2026
nx typecheck cowswap-frontend
```

## Status

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good @tenderdeve, but we have other libs and apps that are passing typecheck right now and can be moved over.

@kernelwhisperer
kernelwhisperer marked this pull request as draft July 28, 2026 14:43
…ript-native-preview

# Conflicts:
#	pnpm-lock.yaml
@tenderdeve

Copy link
Copy Markdown
Contributor Author

@kernelwhisperer thanks — agreed. I've resolved the conflict with develop so this is mergeable again.

On moving more projects over: I looked into it and it's not a clean target-flip. cowswap-frontend type-checks under tsgo with 0 errors, but the libs need a per-project tsconfig cleanup first, because TS 7.0 removed several options that our shared tsconfig.base.json (and some lib configs) still set. Concretely, ui — even after #7905 fixed its code — still fails tsgo:

libs/ui/tsconfig.lib.json: error TS5108: Option 'esModuleInterop=false' has been removed
libs/ui/tsconfig.lib.json: error TS5102: Option 'baseUrl' has been removed
libs/ui/tsconfig.lib.json: error TS5102: Option 'downlevelIteration' has been removed

(ui sets esModuleInterop: false deliberately, and inherits baseUrl/downlevelIteration from the base config — flipping those changes build/interop semantics, so I don't want to bundle it blindly here.)

So I'd suggest keeping this PR scoped to cowswap-frontend (the one project verified clean) and doing the tsconfig-7.0 cleanup + per-lib migration as follow-ups, ticking each off the status table as it's verified. Happy to take ui as the next one if you want — just wanted to flag the esModuleInterop semantic change before touching it. Does that work, or would you prefer the base-config cleanup done up front in this PR?

@kernelwhisperer

Copy link
Copy Markdown
Contributor

Hey @tenderdeve I think we should do the migration to ts 7 in one go and not step by step. Let's try to do it all in this 1 PR, it should be just tsconfig changes, right?

…er (tsgo)

Switch every place that ran tsc to tsgo: cowswap-frontend (already), the
workspace typecheck script, and ui. Make the tsconfigs TS7-compatible, which is
what unblocks the rest of the workspaces:

- tsconfig.base.json: moduleResolution node10 -> bundler; drop the removed
  baseUrl and downlevelIteration options.
- Remove esModuleInterop:false from every project (TS7 is always esModuleInterop
  true); remove baseUrl (cowswap-frontend/explorer keep resolution via a
  paths '*' -> ./src/* map, others just drop it) and downlevelIteration.
- Add a one-line 'declare module inter-ui' shim to the three apps that
  side-effect-import it, since bundler resolution is stricter about untyped
  side-effect imports.

typecheck-workspaces.mjs now only skips balances-and-allowances, which has a
real type error (missing @cowprotocol/cow-sdk Solana exports) unrelated to the
compiler swap; core/snackbars/tokens/ui/wallet now type-check cleanly under tsgo
and are back in the pipeline.

Verified locally with tsgo: tsconfig.base + every non-skipped lib, plus sdk-tools
and widget-configurator, type-check with zero errors. cowswap-frontend and
explorer are left to CI (they exceed local resources here).
@tenderdeve

Copy link
Copy Markdown
Contributor Author

@kernelwhisperer done — migrated the whole monorepo to tsgo in this PR (3ee69c534). You were mostly right that it's tsconfig changes, with two wrinkles worth flagging:

tsconfig changes (base + per-project):

  • tsconfig.base.json: moduleResolution node10bundler, and dropped the TS7-removed baseUrl + downlevelIteration.
  • Removed esModuleInterop: false from every project (TS7 is always esModuleInterop: true — so the ui "deliberately false" case is moot now; it type-checks clean).
  • baseUrl: cowswap-frontend and explorer keep their src/-rooted bare imports via "paths": { "*": ["./src/*"] }; the rest just drop it.

Two non-tsconfig bits it needed:

  • bundler resolution is stricter about untyped side-effect imports, so the three apps that import 'inter-ui' get a one-line declare module 'inter-ui' shim.
  • typecheck-workspaces.mjs now runs tsgo and only skips balances-and-allowances, which has a real error unrelated to the compiler swap — missing SOLANA_SETTLEMENT_PROGRAM_ID / ..._STAGING exports from @cowprotocol/cow-sdk. core/snackbars/tokens/ui/wallet all pass under tsgo now and are back in the pipeline.

Verified locally with tsgo: tsconfig.base + every non-skipped lib, plus sdk-tools and widget-configurator, type-check with 0 errors. cowswap-frontend and explorer exceed local resources on my box (they OOM/hang), so I've left those two for CI to confirm — their only changes are the baseUrlpaths swap (+ inter-ui shim for explorer). If CI is green I'll flip balances-and-allowances in a follow-up once its cow-sdk exports land, or I can take that here too if you'd prefer.

fairlighteth commented Aug 31, 2026

Copy link
Copy Markdown
Contributor
⚠️ AI Review (Codex GPT-5): stale PR check — TypeScript 7 preview roadmap

Finding: [QUESTION] Is this preview migration still a near-term roadmap item?

@tenderdeve, Commander stale-draft check: this preview TypeScript 7 migration changes shared compiler/module semantics, and the frontend/explorer path was not yet fully validated. Is this still a near-term roadmap item? If yes, please update it from develop and outline how full CI/project coverage will be completed; if not, are you okay with closing the preview migration for now?

Suggested next step

  • If active, refresh the branch and complete frontend/explorer validation; otherwise confirm it can close until the roadmap is concrete.
🤖 Prompt for AI agents
Re-evaluate #7907 against current TypeScript 7 preview behavior and the repository roadmap. Verify module-semantics changes across frontend and explorer, or document why the preview migration should be deferred.

Generated using the pr-review skill from the CoW Protocol skills repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

On_hold There's unresolved blockers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants