Skip to content

chore: use tsrs for build type checking - #135

Merged
fengmk2 merged 1 commit into
masterfrom
chore/use-tsrs
Oct 16, 2026
Merged

fengmk2 merged 1 commit into
masterfrom
chore/use-tsrs

Conversation

@fengmk2

@fengmk2 fengmk2 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Replace the TypeScript 5 check in Next.js builds with tsrs to reduce type-check time. The build script checks types after Next.js generates declarations and fails on type errors. npm run typecheck also runs this check directly.

scripts/tsrs.js selects native tsrs on macOS ARM64 and Linux ARM64/x64. It uses @ts-rs/wasm on other platforms, including Windows. The typescript dependency remains because Next.js requires its compiler API.

The configuration uses es2015 and bundler, which the newer compiler supports. Test files remain outside the build's type-check scope, as in Next.js. Explicit Next.js and CSS declarations support type checks before the first build.

Standalone type checking took 89% less time, an 8.88× speedup:

Compiler Median time
typescript@5.9.3 1.267 s
tsrs@0.15.0-ts7.1.0-dev.20260929 0.143 s

Each compiler had one warmup and five interleaved measured runs with the same source, dependencies, and final tsconfig.json. Both used --noEmit --incremental false, fresh processes, and warm filesystem caches. These times cover type checking only, not the full Next.js build.

The machine used an Apple M4 Max, macOS 26.2, and Node.js 22.23.2. The compiler versions target different TypeScript revisions.

Summary by CodeRabbit

  • Chores
    • The production build now runs a TypeScript check after building.
  • Documentation
    • Development instructions now include commands for running TypeScript checks and creating a production build.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 15:42
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cnpmweb Ready Ready Preview Oct 16, 2026 3:46pm UTC

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b821ce66-d3bf-494d-be49-c063d1b9220c
📥 Commits

Reviewing files that changed from the base of the PR and between fdb5000 and 2b98e57.

📒 Files selected for processing: 6
  • README.md
  • index.d.ts
  • next.config.js
  • package.json
  • scripts/tsrs.js
  • tsconfig.json

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The project adds a TypeScript check command and runs it after the Next.js production build. The changes also update TypeScript compiler options, declarations, platform-specific compiler selection, and development instructions.

Changes: TypeScript build checks

Layer / File(s) Summary
Configure TypeScript checking
index.d.ts, tsconfig.json, package.json, scripts/tsrs.js
The TypeScript configuration targets ES2015, uses bundler module resolution, and excludes test files. The declarations add Next.js types and a CSS module declaration. A script selects the native tsrs compiler on specified arm64 and x64 platforms and uses @ts-rs/wasm on other platforms. Both packages are added as development dependencies.
Run checks after the production build
next.config.js, package.json, README.md
The build script runs typecheck after next build. Next.js ignores build-time TypeScript errors, and the development instructions list the typecheck and build commands.

Priority: ⬇️ Low

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

Change: Other

Suggested reviewers: elrrrrrrr

Merge Risk: ⚪ Minimal · up to 2b98e

The checked-in CI and documented package build run the new typecheck. No concrete current-head issue is established; the external webhook’s build command is not visible, so a deployment bypass is unconfirmed.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: using tsrs for build-time TypeScript checking.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

package.json

Parsing error: Missing semicolon. (2:8)

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

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
Addednpm/​@​ts-rs/​wasm@​0.15.0-ts7.1.0-dev.2026092977100999290
Addednpm/​tsrs@​0.15.0-ts7.1.0-dev.20260929100100949290

View full report

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying cnpmweb with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2b98e57
Status: ✅  Deploy successful!
Preview URL: https://d88de0ec.cnpmweb.pages.dev
Branch Preview URL: https://chore-use-tsrs.cnpmweb.pages.dev

View logs

@fengmk2
fengmk2 merged commit 534862b into master Oct 16, 2026
13 checks passed
@fengmk2
fengmk2 deleted the chore/use-tsrs branch October 16, 2026 16:03

This branch was successfully deployed

1 active deployment
Preview — 2b98e57a Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants