Skip to content

Conversation

@juliusmarminge
Copy link
Member

@juliusmarminge juliusmarminge commented Nov 24, 2025

little modernization

Summary by CodeRabbit

  • Chores

    • Updated Node.js baseline to 22.20+ across manifests and tool configs; developer tool versions bumped
    • Replaced TSX-based runners with native Node.js in scripts and removed TSX
    • Migrated TypeScript configs to NodeNext and enabled import/extension rewrite options
    • Made imports explicitly reference .ts extensions for consistency
    • CI/workflows now derive Node version from package manifest
  • New Features

    • Added a generated route tree for TanStack Router integration

✏️ Tip: You can customize this high-level summary in your review settings.


Note

Modernizes the repo to run TS natively: standardizes on Node 22.x, replaces tsx with node, adopts NodeNext TS config, updates imports/paths, and adds a generated TanStack Router route tree.

  • Tooling/Runtime
    • Standardize on Node 22.x (package.json engines, .nvmrc, .tool-versions).
    • CI uses actions/setup-node with node-version-file: package.json.
  • Scripts
    • Replace tsx with native node (watch/exec) across examples, www, and root scripts; remove tsx where unused.
  • TypeScript Configs
    • Switch to module: NodeNext and enable rewriteRelativeImportExtensions, verbatimModuleSyntax, etc.; allow TS extension imports where needed.
    • Update code to explicit .ts imports and use import.meta.dirname instead of __dirname/fileURLToPath.
  • Examples/Apps
    • Align engines, dev/test scripts, and imports across Express/Fastify/Lambda/Standalone/Next examples.
    • Add generated TanStack Router routeTree.gen.ts for the React Start example.
  • Tests/Infra
    • Update vitest.config.ts and tests to use import.meta.dirname and NodeNext-compatible paths.

Written by Cursor Bugbot for commit 6377c89. This will update automatically on new commits. Configure here.

@juliusmarminge juliusmarminge requested review from a team as code owners November 24, 2025 02:45
@railway-app
Copy link

railway-app bot commented Nov 24, 2025

🚅 Deployed to the trpc-pr-7025 environment in trpc-sse-and-websockets

Service Status Web Updated (UTC)
next-prisma-websockets-starter ❌ Build Failed (View Logs) Nov 25, 2025 at 10:43 pm
next-sse-chat ❌ Build Failed (View Logs) Web Nov 25, 2025 at 10:43 pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

Walkthrough

Widespread migration from TSX to native Node execution, Node engine bumps, many imports updated to explicit .ts extensions, CommonJS dirname/fileURLToPath replaced with import.meta.dirname, several tsconfig files switched to NodeNext with new flags, and a generated TanStack route tree added.

Changes

Cohort / File(s) Change Summary
Node version files
​.nvmrc, package.json, examples/*/package.json, www/package.json, .tool-versions
Bumped Node references (e.g., .nvmrc 22.18.0 → 22.21; engines.node added or raised to ^22.20.0); updated .tool-versions nodejs → 22.21.0
Remove TSX from scripts & deps
package.json, www/package.json, packages/tests/package.json, examples/*/package.json, examples/next-big-router/package.json, examples/.test/diagnostics-big-router/package.json, examples/next-prisma-starter/package.json
Replace tsx ... invocations with node ... (often node --watch); remove tsx from dependencies/devDependencies; adjust scripts (prepack/version/prisma.seed/etc.)
TSConfig updates (NodeNext + flags)
examples/*/tsconfig.json, www/tsconfig.json, packages/*/tsconfig.json
Set "module": "NodeNext" where applied; remove moduleResolution; add compiler flags like rewriteRelativeImportExtensions, erasableSyntaxOnly, verbatimModuleSyntax, and sometimes allowImportingTsExtensions/skipLibCheck
Explicit module-specifier extensions
examples/**/src/**, examples/soa/**, examples/lazy-load/**, examples/minimal/**, www/src/**
Convert imports from implicit or .js to explicit .ts (and explicit index paths) across many example and web files
__dirname / fileURLToPath → import.meta.dirname
examples/*/scripts/codegen.ts, examples/next-formdata/src/utils/writeFileToDisk.ts, packages/tests/server/adapters/standalone.http2.test.ts, vitest.config.ts, www/src/components/*.ts, www/src/components/sponsors/*.ts
Replace CommonJS path resolution with ESM import.meta.dirname for file path calculations and writes
Codegen script updates
examples/.test/diagnostics-big-router/scripts/codegen.ts, examples/next-big-router/scripts/codegen.ts, related package.json entries
Run codegen with node scripts/codegen.ts; codegen scripts use import.meta.dirname for path resolution
Lambda createContext signature tweaks
examples/lambda-api-gateway/src/server.ts, examples/lambda-url/src/server.ts
Remove destructured context from createContext parameters; minor import removals
Generated route tree
examples/tanstack-react-start/src/routeTree.gen.ts
New generated file: TanStack route constants, types, module augmentations, and routeTree scaffolding
Test / tooling updates
vitest.config.ts, .github/setup/action.yml, packages/tests/...
vitest and tests switched to ESM path resolution; GitHub Actions now reads Node version from package.json via node-version-file; test cert paths use import.meta.dirname
Miscellaneous
www/docusaurus.typedoc.js, assorted server files
Minor edits: removed an ESLint disable comment, added void server.start(), added allowImportingTsExtensions in www tsconfig, moved prisma seed runner to node

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant NPM as Package scripts
    participant Node as Node runtime
    participant Codegen as scripts/codegen.ts
    participant FS as File System

    Note over NPM,Node: Postinstall / postbuild / prepack runs
    NPM->>Node: run "node scripts/codegen.ts"
    Node->>Codegen: execute ESM script (uses import.meta.dirname)
    Codegen->>FS: read routers & templates
    Codegen->>FS: write generated router files and indexes
    Note right of FS: Generated artifacts updated for consumers
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus areas:
    • examples/tanstack-react-start/src/routeTree.gen.ts (generated types & augmentations)
    • ESM path conversions using import.meta.dirname in scripts, tests, and www components
    • Consistency and correctness of tsconfig NodeNext and new compiler flags across examples

Possibly related PRs

Suggested labels

♻️ autoupdate

Suggested reviewers

  • juliusmarminge
  • cseickel

"🐰 I hopped through imports, lines untwined,
TSX tucked away, Node now aligned.
meta.dirname points the trail,
routes get built — a tiny tail wag, hale!
Cheers from a rabbit, quick and kind 🥕"

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It lacks the required template structure with 'Closes #', '🎯 Changes' section, and '✅ Checklist' with checkboxes. Add the required PR template sections: issue reference, clear summary of changes in the 🎯 Changes section, and completed ✅ Checklist items per Contributing guide.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: modernizing the codebase to run TypeScript natively rather than through tsx.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch node-native-ts

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66e7a33 and 6377c89.

📒 Files selected for processing (1)
  • .tool-versions (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .tool-versions
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: E2E-tests (fastify-server)
  • GitHub Check: E2E-tests (next-prisma-websockets-starter)
  • GitHub Check: E2E-tests (next-prisma-starter)
  • GitHub Check: E2E-tests (express-minimal)
  • GitHub Check: E2E-tests (.test/internal-types-export)
  • GitHub Check: E2E-tests (.test/ssg)
  • GitHub Check: E2E-tests (.experimental/next-app-dir)
  • GitHub Check: e2e-legacy-node (next-prisma-todomvc, 18.x)
  • GitHub Check: e2e-legacy-node (next-prisma-todomvc, 20.x)
  • GitHub Check: e2e-legacy-node (next-prisma-starter, 20.x)
  • GitHub Check: e2e-legacy-node (next-prisma-starter, 18.x)
  • GitHub Check: e2e-legacy-node (next-prisma-websockets-starter, 20.x)
  • GitHub Check: e2e-legacy-node (next-prisma-websockets-starter, 18.x)
  • GitHub Check: E2E-tests (Deno) (deno-deploy)
  • GitHub Check: E2E-tests (Bun) (bun, ubuntu-latest)
  • GitHub Check: Test a monorepo using built declaration files
  • GitHub Check: typecheck-www
  • GitHub Check: Cursor Bugbot
  • GitHub Check: test
  • GitHub Check: Lint and auto-fix
  • GitHub Check: Analyze (typescript)

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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

@railway-app railway-app bot had a problem deploying to next-prisma-websockets-starter (trpc-sse-and-websockets / trpc-pr-7025) November 24, 2025 02:45 Failure
@vercel
Copy link

vercel bot commented Nov 24, 2025

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

Project Deployment Preview Comments Updated (UTC)
next-prisma-starter Ready Ready Preview Nov 25, 2025 10:42pm
og-image Ready Ready Preview Comment Nov 25, 2025 10:42pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
www Ignored Ignored Preview Nov 25, 2025 10:42pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 24, 2025

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/trpc/trpc/@trpc/client@7025

@trpc/next

npm i https://pkg.pr.new/trpc/trpc/@trpc/next@7025

@trpc/react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/react-query@7025

@trpc/server

npm i https://pkg.pr.new/trpc/trpc/@trpc/server@7025

@trpc/tanstack-react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/tanstack-react-query@7025

@trpc/upgrade

npm i https://pkg.pr.new/trpc/trpc/@trpc/upgrade@7025

commit: 6377c89

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
examples/next-formdata/src/utils/writeFileToDisk.ts (1)

15-24: Add error handling and ensure proper stream cleanup.

The file writing lacks error handling and doesn't await stream completion. If writing fails, the stream may not close properly (resource leak), and errors won't be caught.

Apply this diff to add proper error handling:

-  const fd = fs.createWriteStream(path.resolve(`${fileDir}/${file.name}`));
-
-  const fileStream = Readable.fromWeb(
-    // @ts-expect-error - unsure why this is not working
-    file.stream(),
-  );
-  for await (const chunk of fileStream) {
-    fd.write(chunk);
-  }
-  fd.end();
+  const fd = fs.createWriteStream(path.resolve(`${fileDir}/${file.name}`));
+
+  try {
+    const fileStream = Readable.fromWeb(
+      // @ts-expect-error - unsure why this is not working
+      file.stream(),
+    );
+    
+    await new Promise<void>((resolve, reject) => {
+      fd.on('error', reject);
+      fd.on('finish', resolve);
+      fileStream.pipe(fd);
+    });
+  } catch (error) {
+    fd.destroy();
+    throw error;
+  }
examples/express-minimal/package.json (1)

13-13: Critical: test-dev script still references removed tsx dependency.

The test-dev script uses tsx twice, but tsx was removed from devDependencies. This will cause test failures.

Apply this diff:

-    "test-dev": "start-server-and-test 'tsx src/server' 3000 'tsx src/client'",
+    "test-dev": "start-server-and-test 'node src/server.ts' 3000 'node src/client.ts'",
examples/next-prisma-websockets-starter/package.json (1)

13-13: Inconsistent migration: tsx still referenced but removed from dependencies.

Line 13's dev:wss script still invokes tsx, but tsx appears to have been removed from the project. This will cause runtime failures when developers run the script.

Either:

  1. Update the script to use node --experimental-strip-types (or rely on default native TS support in Node 23.6.0+), or
  2. Retain tsx in devDependencies if the migration is incomplete.

Also applies to: 35-35

♻️ Duplicate comments (7)
examples/express-minimal/tsconfig.json (1)

10-12: Verify TypeScript version compatibility (same concern as other tsconfig files).

These new compiler options require TypeScript 5.5-5.7+. Please ensure compatibility across all examples in the repository.

examples/express-server/tsconfig.json (1)

10-12: TypeScript version compatibility concern (duplicate).

Same verification needed for these compiler options as flagged in other tsconfig files.

examples/vercel-edge-runtime/tsconfig.json (1)

13-15: TypeScript version requirement applies here too.

Same as examples/minimal/tsconfig.json, these compiler options require TypeScript 5.7+. The verification script in the minimal example review will check all examples.

examples/fastify-server/tsconfig.json (1)

10-12: TypeScript version requirement applies here too.

Same TypeScript 5.7+ requirement for rewriteRelativeImportExtensions. Already flagged in previous tsconfig reviews.

examples/.test/diagnostics-big-router/scripts/codegen.ts (2)

7-7: Path concatenation style (same as next-big-router).

Same suggestion as examples/next-big-router/scripts/codegen.ts - prefer path.join() over string concatenation.


15-18: Path concatenation consistency.

Same as line 7 and the next-big-router codegen script - consider path.join() for consistency.

examples/.test/diagnostics-big-router/package.json (1)

7-7: Node.js native TypeScript execution requirement.

Same critical issue as examples/lambda-url/package.json - running .ts files with node directly requires Node 22.6.0+ with the --experimental-strip-types flag. This is especially critical in a postinstall script.

🧹 Nitpick comments (6)
examples/next-formdata/src/utils/writeFileToDisk.ts (2)

6-6: Use path.resolve() for consistent path construction.

String concatenation for paths is less robust than using Node.js path utilities. This also maintains consistency with line 9.

Apply this diff:

-  const rootDir = import.meta.dirname + '/../../../../..';
+  const rootDir = path.resolve(import.meta.dirname, '../../../../..');

11-13: Consider removing redundant existence check.

fs.mkdirSync() with { recursive: true } is idempotent and handles existing directories, making the existsSync() check unnecessary. Removing it also eliminates a potential TOCTOU race condition.

Apply this diff:

-  if (!fs.existsSync(fileDir)) {
-    fs.mkdirSync(fileDir, { recursive: true });
-  }
+  fs.mkdirSync(fileDir, { recursive: true });
www/src/components/CompaniesUsing.script.ts (1)

20-20: Consider using path.join for consistency.

While string concatenation works here, using path.join(import.meta.dirname, 'CompaniesUsing.script.output.ts') would be more consistent with line 4's approach.

Apply this diff:

-  import.meta.dirname + '/CompaniesUsing.script.output.ts',
+  path.join(import.meta.dirname, 'CompaniesUsing.script.output.ts'),
vitest.config.ts (1)

42-44: Use path.join() for path concatenation consistency.

While line 10 correctly uses path.resolve(), this setupFiles path uses string concatenation. For consistency and cross-platform safety, prefer path.join().

Apply this diff:

     setupFiles: [
-      import.meta.dirname + '/packages/tests/suppressActWarnings.ts',
+      path.join(import.meta.dirname, 'packages/tests/suppressActWarnings.ts'),
     ],
examples/next-big-router/scripts/codegen.ts (2)

7-7: Prefer path.join() for path construction.

String concatenation for file paths works but is less maintainable and doesn't normalize paths. Since path is already imported from node:path, consider using path.join().

-const ROUTERS_DIR = import.meta.dirname + '/../src/server/routers';
+import path from 'path';
+const ROUTERS_DIR = path.join(import.meta.dirname, '..', 'src', 'server', 'routers');

15-18: Consider using path.join() for consistency.

Similar to line 7, prefer path.join() over string concatenation for better cross-platform compatibility and path normalization.

 const codegenBase = fs.readFileSync(
-  import.meta.dirname + '/codegen-base.ts',
+  path.join(import.meta.dirname, 'codegen-base.ts'),
   'utf-8',
 );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14e3d4a and dd0b12d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (81)
  • .nvmrc (1 hunks)
  • examples/.test/diagnostics-big-router/package.json (1 hunks)
  • examples/.test/diagnostics-big-router/scripts/codegen.ts (1 hunks)
  • examples/cloudflare-workers/package.json (1 hunks)
  • examples/cloudflare-workers/src/client.ts (1 hunks)
  • examples/express-minimal/package.json (1 hunks)
  • examples/express-minimal/src/client.ts (1 hunks)
  • examples/express-minimal/src/server.ts (1 hunks)
  • examples/express-minimal/tsconfig.json (1 hunks)
  • examples/express-server/package.json (1 hunks)
  • examples/express-server/src/client.ts (1 hunks)
  • examples/express-server/tsconfig.json (1 hunks)
  • examples/fastify-server/package.json (1 hunks)
  • examples/fastify-server/src/client/index.ts (1 hunks)
  • examples/fastify-server/src/config.ts (1 hunks)
  • examples/fastify-server/src/server/index.ts (1 hunks)
  • examples/fastify-server/src/server/router/index.ts (1 hunks)
  • examples/fastify-server/src/server/router/routers/api.ts (1 hunks)
  • examples/fastify-server/src/server/router/routers/posts.ts (1 hunks)
  • examples/fastify-server/src/server/router/routers/sub.ts (1 hunks)
  • examples/fastify-server/src/server/router/trpc.ts (1 hunks)
  • examples/fastify-server/src/server/server.ts (1 hunks)
  • examples/fastify-server/tsconfig.json (1 hunks)
  • examples/lambda-api-gateway/package.json (1 hunks)
  • examples/lambda-api-gateway/src/client.ts (1 hunks)
  • examples/lambda-api-gateway/src/payloadFormatVersionClient.ts (1 hunks)
  • examples/lambda-api-gateway/src/server.ts (0 hunks)
  • examples/lambda-api-gateway/tsconfig.json (1 hunks)
  • examples/lambda-url/package.json (1 hunks)
  • examples/lambda-url/src/client.ts (1 hunks)
  • examples/lambda-url/src/server.ts (0 hunks)
  • examples/lambda-url/tsconfig.json (1 hunks)
  • examples/lazy-load/package.json (1 hunks)
  • examples/lazy-load/src/client/index.ts (1 hunks)
  • examples/lazy-load/src/server/index.ts (1 hunks)
  • examples/lazy-load/src/server/routers/_app.ts (1 hunks)
  • examples/lazy-load/src/server/routers/slow.ts (1 hunks)
  • examples/lazy-load/src/server/routers/user.ts (1 hunks)
  • examples/lazy-load/tsconfig.json (1 hunks)
  • examples/minimal-content-types/server/package.json (1 hunks)
  • examples/minimal-content-types/server/tsconfig.json (1 hunks)
  • examples/minimal-react/server/package.json (1 hunks)
  • examples/minimal-react/server/tsconfig.json (1 hunks)
  • examples/minimal/package.json (1 hunks)
  • examples/minimal/src/client/index.ts (1 hunks)
  • examples/minimal/src/server/index.ts (1 hunks)
  • examples/minimal/src/server/trpc.ts (1 hunks)
  • examples/minimal/tsconfig.json (1 hunks)
  • examples/next-big-router/package.json (1 hunks)
  • examples/next-big-router/scripts/codegen.ts (1 hunks)
  • examples/next-formdata/src/utils/writeFileToDisk.ts (1 hunks)
  • examples/next-prisma-starter/package.json (1 hunks)
  • examples/next-prisma-websockets-starter/package.json (1 hunks)
  • examples/soa/client/client.ts (1 hunks)
  • examples/soa/client/index.ts (1 hunks)
  • examples/soa/faux-gateway/index.ts (1 hunks)
  • examples/soa/package.json (1 hunks)
  • examples/soa/server-a/index.ts (1 hunks)
  • examples/soa/server-a/router.ts (1 hunks)
  • examples/soa/server-b/index.ts (1 hunks)
  • examples/soa/server-b/router.ts (1 hunks)
  • examples/soa/tsconfig.json (1 hunks)
  • examples/standalone-server/package.json (1 hunks)
  • examples/standalone-server/src/client.ts (1 hunks)
  • examples/standalone-server/tsconfig.json (1 hunks)
  • examples/tanstack-react-start/src/routeTree.gen.ts (1 hunks)
  • examples/vercel-edge-runtime/package.json (1 hunks)
  • examples/vercel-edge-runtime/src/client.ts (1 hunks)
  • examples/vercel-edge-runtime/src/index.ts (1 hunks)
  • examples/vercel-edge-runtime/tsconfig.json (1 hunks)
  • package.json (1 hunks)
  • packages/tests/package.json (0 hunks)
  • packages/tests/server/adapters/standalone.http2.test.ts (1 hunks)
  • vitest.config.ts (2 hunks)
  • www/docusaurus.typedoc.js (0 hunks)
  • www/package.json (1 hunks)
  • www/src/components/CompaniesUsing.script.ts (2 hunks)
  • www/src/components/TwitterWall/script.ts (1 hunks)
  • www/src/components/sponsors/script.pull.ts (3 hunks)
  • www/src/components/sponsors/script.push.ts (2 hunks)
  • www/tsconfig.json (1 hunks)
💤 Files with no reviewable changes (4)
  • packages/tests/package.json
  • examples/lambda-api-gateway/src/server.ts
  • examples/lambda-url/src/server.ts
  • www/docusaurus.typedoc.js
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Always use import type for type-only imports
Separate type imports from value imports
Avoid overzealous object destructuring; prefer direct property access
Object destructuring is acceptable when a variable is used 3+ times
Prefer array destructuring
Avoid sparse array destructuring
Never destructure in function parameter declarations
Avoid destructuring potentially nullish nested properties
Maximum 3 parameters per function; use options objects when more
Type parameter names must match /^(T|$)(A-Z)?[0-9]*$/
Prefix unused variables, parameters, and caught errors with _
Prefer namespace imports for validation libraries and large modules (e.g., import * as z from 'zod', import * as React from 'react')
Follow import order: test helpers, tRPC test imports, third-party, then relative
Never import from @trpc/*/src; import from the package root instead
Do not use Symbol.dispose or Symbol.asyncDispose; use makeResource()/makeAsyncResource()
Always use await using for resource cleanup
Prefer makeResource()/makeAsyncResource() over manual disposal logic
Avoid non-null assertions (!)
Use proper type guards and optional chaining instead of non-null assertions
Switch statements must be exhaustive for union types
Rely on TypeScript inference; avoid unnecessary explicit return/output types
Use explicit types at public API boundaries, for complex generic constraints, or when inference is insufficient/ambiguous
Use the satisfies operator to retain inference while enforcing shapes
Use as const for literal type inference when appropriate
Prefer explicit typing over any
Use type assertions sparingly
Leverage TypeScript strict mode features

Files:

  • examples/fastify-server/src/server/router/routers/posts.ts
  • examples/minimal/src/client/index.ts
  • examples/next-formdata/src/utils/writeFileToDisk.ts
  • examples/express-minimal/src/client.ts
  • www/src/components/CompaniesUsing.script.ts
  • examples/lazy-load/src/client/index.ts
  • examples/lambda-url/src/client.ts
  • examples/vercel-edge-runtime/src/client.ts
  • examples/fastify-server/src/server/router/index.ts
  • examples/fastify-server/src/server/router/routers/api.ts
  • examples/lazy-load/src/server/index.ts
  • examples/next-big-router/scripts/codegen.ts
  • examples/soa/server-b/router.ts
  • examples/fastify-server/src/server/router/trpc.ts
  • examples/soa/server-a/index.ts
  • examples/lambda-api-gateway/src/payloadFormatVersionClient.ts
  • examples/vercel-edge-runtime/src/index.ts
  • examples/fastify-server/src/config.ts
  • examples/fastify-server/src/server/server.ts
  • examples/soa/server-b/index.ts
  • examples/express-server/src/client.ts
  • www/src/components/sponsors/script.push.ts
  • examples/lambda-api-gateway/src/client.ts
  • examples/lazy-load/src/server/routers/slow.ts
  • examples/lazy-load/src/server/routers/user.ts
  • examples/tanstack-react-start/src/routeTree.gen.ts
  • www/src/components/TwitterWall/script.ts
  • packages/tests/server/adapters/standalone.http2.test.ts
  • vitest.config.ts
  • examples/express-minimal/src/server.ts
  • examples/soa/server-a/router.ts
  • examples/soa/client/client.ts
  • examples/lazy-load/src/server/routers/_app.ts
  • examples/standalone-server/src/client.ts
  • examples/fastify-server/src/client/index.ts
  • examples/minimal/src/server/trpc.ts
  • examples/cloudflare-workers/src/client.ts
  • examples/soa/client/index.ts
  • examples/minimal/src/server/index.ts
  • examples/fastify-server/src/server/router/routers/sub.ts
  • www/src/components/sponsors/script.pull.ts
  • examples/fastify-server/src/server/index.ts
  • examples/soa/faux-gateway/index.ts
**/*.{ts,tsx,md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use camelCase for file names (with exceptions like TRPC/RPC/HTTP/JSON acronyms, .config.js, .d.ts, and tests)

Files:

  • examples/fastify-server/src/server/router/routers/posts.ts
  • examples/minimal/src/client/index.ts
  • examples/next-formdata/src/utils/writeFileToDisk.ts
  • examples/express-minimal/src/client.ts
  • www/src/components/CompaniesUsing.script.ts
  • examples/lazy-load/src/client/index.ts
  • examples/lambda-url/src/client.ts
  • examples/vercel-edge-runtime/src/client.ts
  • examples/fastify-server/src/server/router/index.ts
  • examples/fastify-server/src/server/router/routers/api.ts
  • examples/lazy-load/src/server/index.ts
  • examples/next-big-router/scripts/codegen.ts
  • examples/soa/server-b/router.ts
  • examples/fastify-server/src/server/router/trpc.ts
  • examples/soa/server-a/index.ts
  • examples/lambda-api-gateway/src/payloadFormatVersionClient.ts
  • examples/vercel-edge-runtime/src/index.ts
  • examples/fastify-server/src/config.ts
  • examples/fastify-server/src/server/server.ts
  • examples/soa/server-b/index.ts
  • examples/express-server/src/client.ts
  • www/src/components/sponsors/script.push.ts
  • examples/lambda-api-gateway/src/client.ts
  • examples/lazy-load/src/server/routers/slow.ts
  • examples/lazy-load/src/server/routers/user.ts
  • examples/tanstack-react-start/src/routeTree.gen.ts
  • www/src/components/TwitterWall/script.ts
  • packages/tests/server/adapters/standalone.http2.test.ts
  • vitest.config.ts
  • examples/express-minimal/src/server.ts
  • examples/soa/server-a/router.ts
  • examples/soa/client/client.ts
  • examples/lazy-load/src/server/routers/_app.ts
  • examples/standalone-server/src/client.ts
  • examples/fastify-server/src/client/index.ts
  • examples/minimal/src/server/trpc.ts
  • examples/cloudflare-workers/src/client.ts
  • examples/soa/client/index.ts
  • examples/minimal/src/server/index.ts
  • examples/fastify-server/src/server/router/routers/sub.ts
  • www/src/components/sponsors/script.pull.ts
  • examples/fastify-server/src/server/index.ts
  • examples/soa/faux-gateway/index.ts
**/*.test.ts

📄 CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)

**/*.test.ts: ALWAYS use await using ctx = testServerAndClientResource(...) in tests that need both server and client setup
NEVER use the deprecated routerToServerAndClientNew() in tests
Import testServerAndClientResource from @trpc/client/__tests__/testClientResource
Create fresh mock instances per test using a factory (e.g., getMockFetch())
Do not use global mocks that persist across tests
Configure mocks via the client callback in testServerAndClientResource options
Use ctx.client from the test resource for making tRPC calls
Access server URLs via ctx.httpUrl and ctx.wssUrl
Configure server options via the server property in testServerAndClientResource options
Configure client options via the client callback in testServerAndClientResource options
Use descriptive test names that explain the behavior under test
Focus test names on what the test validates, not just what it does
Use proper TypeScript typing for mocks
Clear mocks between tests when needed
Use factory functions for mock creation to ensure isolation

Files:

  • packages/tests/server/adapters/standalone.http2.test.ts
{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}: Do not use Testing Library waitFor; use vi.waitFor instead
Tests may use non-null assertions
Tests may have unused variables
Tests may allow floating promises

Files:

  • packages/tests/server/adapters/standalone.http2.test.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

No console.log in packages; use proper logging instead

Files:

  • packages/tests/server/adapters/standalone.http2.test.ts
🧬 Code graph analysis (3)
www/src/components/CompaniesUsing.script.ts (1)
www/docusaurus.typedoc.js (1)
  • path (4-4)
examples/lazy-load/src/server/routers/_app.ts (3)
examples/fastify-server/src/server/router/trpc.ts (1)
  • router (12-12)
examples/lazy-load/src/server/trpc.ts (1)
  • router (13-13)
packages/server/src/unstable-core-do-not-import/router.ts (1)
  • lazy (105-135)
www/src/components/sponsors/script.pull.ts (1)
www/docusaurus.typedoc.js (1)
  • fs (3-3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test
  • GitHub Check: typecheck
  • GitHub Check: Lint and auto-fix
🔇 Additional comments (65)
packages/tests/server/adapters/standalone.http2.test.ts (1)

24-24: Code change verified and approved.

The project's minimum Node.js version of ^22.18.0 fully supports import.meta.dirname (available since v20.11.0). The change from __dirname to import.meta.dirname is correct, safe, and properly aligned with ES module modernization.

examples/fastify-server/src/server/router/trpc.ts (1)

3-3: LGTM! Explicit .ts extension added correctly.

The type-only import correctly uses import type and includes the explicit .ts extension as required for NodeNext module resolution.

examples/fastify-server/src/config.ts (1)

1-1: LGTM! Type import with explicit extension.

The import correctly uses import type for the type-only import and includes the explicit .ts extension.

examples/fastify-server/src/server/router/routers/posts.ts (1)

3-3: LGTM! Value import with explicit extension.

The explicit .ts extension is correctly added to the value import path.

examples/fastify-server/src/server/index.ts (1)

1-6: LGTM! Imports and server startup updated correctly.

  • Explicit .ts extensions added to both imports
  • The void operator on line 6 appropriately discards the Promise, making the fire-and-forget intent clear
examples/fastify-server/src/server/router/index.ts (1)

1-4: LGTM! All imports consistently updated with explicit extensions.

All four import statements correctly include the explicit .ts extension, maintaining consistency across the router module.

examples/fastify-server/src/server/router/routers/sub.ts (1)

2-2: LGTM! Explicit extension added to value import.

The import path correctly includes the .ts extension.

examples/fastify-server/src/server/server.ts (1)

4-5: LGTM! Router imports updated with explicit extensions.

Both import statements correctly include explicit .ts extensions for the router context and index modules.

examples/fastify-server/src/client/index.ts (1)

9-11: LGTM! All imports correctly updated with explicit extensions.

  • Line 9: Value import with .ts extension
  • Line 10: Type import correctly uses import type with explicit .ts extension
  • Line 11: Side-effect import with .ts extension

All changes follow the coding guidelines and support NodeNext module resolution.

examples/fastify-server/src/server/router/routers/api.ts (1)

2-2: LGTM! Explicit file extension is correct for NodeNext module resolution.

The addition of the .ts extension to the import path is required for NodeNext/Node16 module resolution and aligns with the PR's modernization objectives.

examples/tanstack-react-start/src/routeTree.gen.ts (1)

1-86: Generated route tree wiring and typings look sound

The generated file cleanly wires the two routes into the root route, exposes the expected FileRouteTypes/RootRouteChildren mappings, and augments both @tanstack/react-router and @tanstack/react-start with consistent ids/paths and the router: Awaited<ReturnType<typeof getRouter>> type. Given that it’s auto-generated and lint/TS checks are intentionally disabled, there’s nothing here that needs manual adjustment.

examples/next-big-router/package.json (1)

9-9: LGTM! Migration to native Node.js execution.

The postinstall script correctly migrates from tsx to Node with an explicit .ts extension, and tsx was removed from dependencies.

examples/vercel-edge-runtime/package.json (1)

8-8: LGTM! Consistent migration to Node-based execution.

The test-dev script correctly migrates from tsx to Node with an explicit .ts extension, and tsx was removed from devDependencies.

examples/express-server/src/client.ts (1)

3-3: LGTM! Explicit .ts extension for NodeNext module resolution.

The type-only import correctly adds the .ts extension, which is required for NodeNext module resolution. This follows the coding guidelines for type-only imports.

examples/lambda-api-gateway/src/payloadFormatVersionClient.ts (1)

2-2: LGTM! Explicit .ts extension for type import.

The type-only import correctly adds the .ts extension for NodeNext module resolution, consistent with the broader PR migration.

examples/cloudflare-workers/src/client.ts (1)

2-2: LGTM! Explicit .ts extension for type import.

The type-only import correctly adds the .ts extension, aligning with the repository-wide migration to NodeNext module resolution.

examples/lambda-api-gateway/package.json (1)

11-12: LGTM! Complete migration to Node-based execution.

Both client scripts correctly migrate from tsx to Node with explicit .ts extensions, and tsx was removed from dependencies. The migration is consistent and complete.

examples/lambda-url/src/client.ts (1)

6-6: LGTM! Explicit .ts extension for type import.

The type-only import correctly adds the .ts extension, consistent with the repository-wide migration to NodeNext module resolution.

examples/minimal/src/client/index.ts (1)

13-14: LGTM! Explicit .ts extensions added correctly.

The explicit TypeScript extensions align with NodeNext module resolution and the type-only import correctly uses import type as per coding guidelines.

examples/standalone-server/src/client.ts (1)

9-9: LGTM! Type import extension updated correctly.

The explicit .ts extension on the type-only import is consistent with the PR's module resolution changes.

examples/vercel-edge-runtime/src/index.ts (1)

2-2: LGTM! Import extension updated correctly.

The explicit .ts extension is consistent with the PR's module resolution changes.

examples/express-minimal/src/server.ts (1)

3-3: LGTM! Import extension updated correctly.

The explicit .ts extension aligns with NodeNext module resolution.

examples/soa/faux-gateway/index.ts (1)

1-3: LGTM! All import extensions updated consistently.

All three imports correctly use explicit .ts extensions, maintaining consistency with the PR's module resolution changes.

examples/minimal-react/server/package.json (1)

7-7: The review comment is incorrect. The code works as-is.

Node.js 22.18.0+ has type stripping enabled by default, meaning the --experimental-strip-types flag is not required. The project specifies "node": "^22.18.0" in its root package.json, so the current script "dev": "node --watch index.ts" will execute successfully without the flag. The claim that the script "will fail to run" is factually incorrect for the project's specified Node version.

Likely an incorrect or invalid review comment.

www/tsconfig.json (1)

7-7: LGTM!

The addition of allowImportingTsExtensions: true is correctly paired with noEmit: true (line 8) and aligns with the PR's goal of enabling native TypeScript execution with explicit .ts extensions in imports.

examples/lazy-load/src/client/index.ts (1)

8-8: LGTM!

The import path correctly updated to use explicit .ts extension, and properly uses import type for the type-only import as per coding guidelines.

examples/minimal/src/server/trpc.ts (1)

2-2: LGTM!

The import path correctly updated to use explicit .ts extension for the value import.

examples/minimal/src/server/index.ts (1)

6-7: LGTM!

Import paths correctly updated to use explicit .ts extensions, and import order follows the coding guidelines (third-party imports before relative imports).

examples/express-minimal/src/client.ts (1)

2-2: LGTM!

The import path correctly updated to use explicit .ts extension, and properly uses import type for the type-only import as per coding guidelines.

examples/soa/tsconfig.json (1)

3-11: TypeScript version confirmed compatible with all compiler options.

The project specifies TypeScript ^5.9.2 in examples/soa/package.json, which exceeds all minimum version requirements for the compiler options used:

  • rewriteRelativeImportExtensions (TS 5.7+) ✓
  • erasableSyntaxOnly (TS 5.5+) ✓
  • verbatimModuleSyntax (TS 5.0+) ✓

No issues found.

www/src/components/TwitterWall/script.ts (1)

132-132: Let me gather more context about how this script is used:

Let me verify the project structure and whether www inherits the root package.json constraint:

Let me check the root package.json to see if this is a workspace setup:

Based on my verification, I can now provide the final assessment:

Root package.json specifies Node.js ^22.18.0, which satisfies the minimum v20.11.0 requirement for import.meta.dirname.

Since Node.js version 20.11.0, import.meta.dirname is available as a proper ES module feature. The root package.json constraint of ^22.18.0 ensures the requirement is met.

However, www/package.json does not declare an engines.node field. While this file will inherit the root constraint in a workspace setup, it's a best practice to explicitly declare the Node.js requirement for independent clarity. Consider adding:

{
  "engines": {
    "node": "^22.18.0"
  }
}

to www/package.json to ensure the requirement is explicit and maintained if the package is ever treated independently.

The code migration itself is correct and compatible with the project's Node.js version.

examples/express-server/package.json (1)

6-7: Add Node.js version constraint and clarify mixed TypeScript execution approach.

The dev:server script using node --watch src/server.ts requires Node.js 22.18.0+ for default TypeScript support (earlier versions needed the --experimental-strip-types flag). However, package.json lacks an engines.node field, so developers could inadvertently use incompatible versions.

The mixed approach is real: dev:server uses native Node while dev:client uses tsx. Since both watch TypeScript files, consider either:

  1. Adding "engines": { "node": ">=22.18.0" } to ensure compatibility
  2. Aligning both scripts to use the same runner if the mixed approach isn't intentional
examples/vercel-edge-runtime/src/client.ts (1)

2-2: LGTM! Explicit TypeScript extension added correctly.

The type import now uses an explicit .ts extension, which aligns with the new rewriteRelativeImportExtensions compiler option and follows the import type syntax correctly per coding guidelines.

examples/lambda-api-gateway/src/client.ts (1)

2-2: LGTM! Type import updated with explicit extension.

The explicit .ts extension aligns with the repository-wide modernization and correctly uses import type per coding guidelines.

examples/soa/client/index.ts (1)

1-1: LGTM! Import path updated correctly.

The change from .js to .ts extension is consistent with the new TypeScript configuration and the value import (not type-only) is correctly using a regular import statement.

examples/soa/client/client.ts (1)

2-2: LGTM! Type import path modernized.

The type import now uses the explicit .ts extension, consistent with the repository-wide changes, and correctly follows the import type syntax per coding guidelines.

examples/minimal-react/server/tsconfig.json (1)

9-11: No issues found — TypeScript version is compatible with all compiler options.

The repository consistently uses TypeScript ^5.9.2 across all packages and examples, which exceeds the minimum version requirements for all three compiler options:

  • rewriteRelativeImportExtensions (5.7+) ✓
  • erasableSyntaxOnly (5.5+) ✓
  • verbatimModuleSyntax (5.0+) ✓

The changes are fully supported by the project's TypeScript version.

examples/cloudflare-workers/package.json (2)

8-8: No issues found — verification confirms tsx was never a dependency of cloudflare-workers.

The package.json shows no tsx in devDependencies, and the test-dev script uses node src/client.ts directly rather than tsx. Other example packages that do use tsx are unaffected by changes to cloudflare-workers, as each maintains its own dependencies.


8-8: The code change is correct and no issues were found.

Node.js v22.18.0 has type stripping enabled by default, so the script node src/client.ts will execute correctly without tsx or additional experimental flags. Since the root package.json specifies Node ^22.18.0, this change is compatible and requires no modifications.

examples/minimal/tsconfig.json (1)

9-11: No TypeScript version compatibility issues found.

The project uses TypeScript ^5.9.2, which exceeds the minimum version requirement for rewriteRelativeImportExtensions (TypeScript 5.7+). All three compiler options are compatible with the specified version.

vitest.config.ts (1)

10-10: Node.js version requirement is satisfied.

The project specifies a minimum Node.js version of ^22.18.0 in package.json, which exceeds the import.meta.dirname requirement of Node.js 20.11.0 or higher. All configuration sources (package.json engines, .nvmrc, and CI workflows) confirm Node.js 22.x compatibility. No issues remain.

examples/next-prisma-websockets-starter/package.json (1)

5-5: Verify Node version requirement for native TypeScript support.

Starting from version 23, the --experimental-strip-types flag is enabled by default, enabling direct TypeScript execution. However, this package specifies "node": ">=18.15.0" (line 5), which predates native TypeScript support (available from 22.6.0+).

Ensure the engines.node version requirement is updated to reflect the minimum Node version that supports native TypeScript execution, or ensure a compatible runtime is guaranteed elsewhere.

Also applies to: 35-35

examples/lambda-api-gateway/tsconfig.json (1)

5-5: ✓ Solid TypeScript configuration for Node.js native support.

The compiler options align well with Node.js native TypeScript support requirements, including "rewriteRelativeImportExtensions": true, "verbatimModuleSyntax": true, and "erasableSyntaxOnly": true. Configuration is clean and follows current best practices.

Also applies to: 8-12

examples/lazy-load/tsconfig.json (1)

9-12: ✓ Proper configuration for Node.js native TypeScript support.

The compiler options follow the recommended pattern for Node.js native type stripping, including strict module semantics and extension rewriting. Configuration is sound.

examples/minimal-content-types/server/tsconfig.json (1)

4-4: ✓ Properly configured for Node.js native TypeScript.

TypeScript compiler options align with native type stripping requirements. Configuration is appropriate.

Also applies to: 6-10

examples/next-prisma-starter/package.json (1)

27-27: The suggested Node version constraint conflicts with Next.js 15.3.1 and overlooks a critical setup issue.

The seed script node prisma/seed.ts requires TypeScript execution tooling that isn't configured. Currently it will fail on any Node version without either:

  • Adding ts-node or tsx to devDependencies and updating the seed command, OR
  • Using the experimental --experimental-strip-types flag (not recommended for production)

Additionally, Next.js 15.3.1 requires Node.js >= 18.18.0, so enforcing >=22.6.0 would force users to a higher version than Next.js itself requires. The constraint should instead match or slightly exceed Next.js's minimum (e.g., >=18.18.0 or >=20.0.0), not jump to 22.6.0+.

Fix required:

  1. Add ts-node or tsx as a devDependency
  2. Update seed script: "seed": "tsx prisma/seed.ts" (or use ts-node)
  3. Add engines.node constraint aligned with Next.js 15.3.1: ">=18.18.0" or ">=20.0.0"
⛔ Skipped due to learnings
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6262
File: examples/minimal-react/client/package.json:16-17
Timestamp: 2025-02-12T16:56:46.960Z
Learning: In examples and codemods targeting future versions, dependencies may intentionally use upcoming versions (e.g., React v19) or `next` tags, even if those versions haven't been officially released yet.
examples/lambda-url/tsconfig.json (1)

5-12: TS config matches Node-native TS recommendations

module: "NodeNext" together with allowImportingTsExtensions, rewriteRelativeImportExtensions, erasableSyntaxOnly, and verbatimModuleSyntax is exactly the setup recommended for Node’s built‑in TS type‑stripping and .ts imports, with noEmit keeping tsc as typecheck-only. Looks good.

examples/standalone-server/tsconfig.json (1)

5-12: NodeNext + TS extension flags are consistent; skipLibCheck acceptable for example

This mirrors the recommended Node-native TS pattern and matches how other examples are configured. skipLibCheck: true is a reasonable perf trade‑off here.

package.json (1)

29-30: Using node scripts/version.ts is fine with Node 22.18+, assuming only erasable TS syntax

Given the engines.node: "^22.18.0", calling node scripts/version.ts leverages Node’s built‑in TS type‑stripping and is valid as long as version.ts only uses erasable TS syntax (no enums, parameter properties, runtime namespaces, etc.) that would require transformation.

examples/standalone-server/package.json (1)

6-7: Dev/test scripts now consistently use Node for TS and built JS

dev:server/dev:client using node --watch on .ts sources and test-dev/test-start targeting the same .ts and built .js entrypoints are consistent with Node 22+ native TS support and the esbuild output layout. No issues spotted.

Also applies to: 13-14

examples/minimal/package.json (1)

7-8: Minimal example scripts cleanly migrated to Node-run .ts and built .js

The dev and test scripts consistently use node for both .ts sources and dist/*/index.js outputs, aligning with the new Node-native TS setup and keeping this example in sync with the others.

Also applies to: 10-11

examples/soa/server-b/index.ts (1)

2-2: Router import updated to .ts in line with NodeNext + TS extensions

Switching the router import to ./router.ts keeps the runtime specifier aligned with the actual TS source and matches the NodeNext + allowImportingTsExtensions pattern used elsewhere. Import order is also compliant.

examples/lazy-load/src/server/index.ts (1)

5-5: App router import moved to .ts to match TS-native runtime flow

Using ./routers/_app.ts matches the new TS extension strategy and keeps this entrypoint consistent with the rest of the lazy-load example and the NodeNext configuration.

examples/lazy-load/src/server/routers/slow.ts (1)

1-1: LGTM: Import path updated to explicit TypeScript extension.

The migration from .js to .ts extension aligns with the PR's objective to run TypeScript natively.

examples/soa/server-a/router.ts (1)

1-1: LGTM: Import path updated consistently.

The change from .js to .ts extension is consistent with the TypeScript native migration.

examples/soa/server-b/router.ts (1)

1-1: LGTM: Import path updated consistently.

This change mirrors the pattern across other SOA example files and correctly uses the explicit .ts extension.

examples/lazy-load/src/server/routers/user.ts (1)

5-6: LGTM: Import paths updated to TypeScript extensions.

The migration from .js to .ts extensions is correct and consistent with the PR objective.

examples/soa/server-a/index.ts (1)

2-2: LGTM: Import path updated correctly.

The change to use the explicit .ts extension is consistent with the TypeScript native migration strategy.

www/src/components/sponsors/script.pull.ts (2)

4-4: LGTM: Type import updated with explicit extension.

The use of import type is correct for type-only imports, and adding the .ts extension aligns with the migration strategy.


193-193: Verified: Node.js version supports import.meta.dirname.

The project specifies a minimum Node.js version of 22.18.0 (package.json) and 22.21 (.nvmrc), which exceeds the requirement introduced in v20.11.0. The migration from __dirname to import.meta.dirname is fully supported.

www/src/components/sponsors/script.push.ts (2)

4-4: LGTM: Import path updated correctly.

The change to use the explicit .ts extension is correct for this value import.


146-146: Verify Node.js version compatibility (same as script.pull.ts).

As with script.pull.ts, the use of import.meta.dirname requires Node.js 20.11.0+ or 21.2.0+. Ensure this aligns with the project's Node.js version requirements.

examples/lazy-load/src/server/routers/_app.ts (2)

2-2: LGTM: Import path updated to TypeScript extension.

The change from .js to .ts is consistent with the native TypeScript execution approach.


5-7: LGTM: Dynamic import paths updated correctly.

The lazy-loaded module paths now use .ts extensions, which is correct for the new TypeScript module resolution configuration. The lazy() helper from tRPC will properly handle these dynamic imports.

www/package.json (1)

15-16: Node.js cannot execute TypeScript files without a loader or transpiler—scripts will fail at runtime.

The four npm scripts (lines 15–16, 19, 21) attempt to run .ts files directly with the node command, but no TypeScript execution mechanism is configured:

  • No Node.js loader (--loader) in package.json or .npmrc
  • No --experimental-strip-types flag configured
  • No build step that pre-compiles scripts
  • No tsx or ts-node in devDependencies (tsx was removed)
  • tsconfig.json has noEmit: true (doesn't generate JavaScript output)

The script files contain TypeScript syntax and ES6 imports that require runtime transpilation. Without a loader or compilation step, these will fail with syntax/module errors when invoked.

Required fixes:

  • Configure a Node.js loader (e.g., tsx, esbuild-register, or use --experimental-strip-types flag if Node v22+)
  • OR add a build step that pre-compiles scripts to JavaScript before execution
  • Update npm scripts with appropriate flags or add tsx back as devDependency with loader configuration
⛔ Skipped due to learnings
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Leverage TypeScript strict mode features
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to packages/**/*.{ts,tsx} : No `console.log` in packages; use proper logging instead
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Do NOT import legacy-only helpers like createAppRouter from './__testHelpers' in upgrade-package tests
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : For migration testing, exercise both legacy and modern patterns via ctx.rq and ctx.trq within the same test when relevant
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6789
File: packages/tanstack-react-query/tsdown.config.ts:1-24
Timestamp: 2025-06-09T14:01:20.033Z
Learning: In the tRPC monorepo, packages/tests and packages/upgrade don't need main/module/types fields in their package.json because tests is not distributed and upgrade just exposes a binary.

import path from 'path';

const WWW_ROOT = path.join(__dirname, '../../');
const WWW_ROOT = path.join(import.meta.dirname, '../../');
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify ES module configuration for import.meta.dirname.

The usage of import.meta.dirname is correct for ES modules. Ensure that this package has "type": "module" in its package.json or this script is run with proper ES module support.

Run the following script to verify the module type configuration:


🏁 Script executed:

#!/bin/bash
# Check if www/package.json has "type": "module"
fd -t f "package.json" www --max-depth 2 --exec cat {} \; | jq -r 'select(.type == "module") | "Module type: \(.type)"'

# Also check for tsconfig module settings
fd -t f "tsconfig.json" www --max-depth 2 --exec cat {} \; | jq -r '.compilerOptions.module // empty'

Length of output: 6


I need to get more complete information about the package.json configuration. Let me run a more direct verification:


---

🏁 Script executed:

```shell
#!/bin/bash
# Direct check for www/package.json
echo "=== www/package.json ==="
cat www/package.json 2>/dev/null | jq '.type' || echo "Not found or no type field"

# Full tsconfig check
echo "=== www/tsconfig.json compilerOptions.module and target ==="
cat www/tsconfig.json 2>/dev/null | jq '.compilerOptions | {module, target}' || echo "Not found"

Length of output: 284


Let me run a corrected verification script:


🏁 Script executed:

#!/bin/bash
# Check www/package.json exists and show type field
echo "=== www/package.json type field ==="
if [ -f www/package.json ]; then
  jq '.type' www/package.json 2>/dev/null || echo "(no type field found)"
else
  echo "www/package.json not found"
fi

# Show full compilerOptions from tsconfig
echo "=== www/tsconfig.json compilerOptions.module ==="
if [ -f www/tsconfig.json ]; then
  jq '.compilerOptions.module' www/tsconfig.json 2>/dev/null || echo "Not found"
else
  echo "www/tsconfig.json not found"
fi

# Show target
echo "=== www/tsconfig.json compilerOptions.target ==="
if [ -f www/tsconfig.json ]; then
  jq '.compilerOptions.target' www/tsconfig.json 2>/dev/null || echo "Not found"
else
  echo "File not found"
fi

Length of output: 148


Let me inspect the actual file contents to understand the full configuration:


🏁 Script executed:

#!/bin/bash
# Show full www/package.json
echo "=== www/package.json (full) ==="
cat www/package.json

echo -e "\n=== www/tsconfig.json (full) ==="
cat www/tsconfig.json

echo -e "\n=== Root package.json type field ==="
if [ -f package.json ]; then
  jq '.type' package.json 2>/dev/null || echo "(no type field found)"
else
  echo "Root package.json not found"
fi

Length of output: 4198


Add "type": "module" to www/package.json.

The verification confirms a critical issue: www/package.json does not have "type": "module", while import.meta.dirname requires ES module support. When the script runs via node ./src/components/CompaniesUsing.script.ts, Node.js resolves the closest package.json (www/package.json), treating the file as CommonJS without the "type": "module" field. This will cause import.meta.dirname to fail at runtime.

Add "type": "module" to www/package.json.

🤖 Prompt for AI Agents
In www/src/components/CompaniesUsing.script.ts around line 4, Node will treat
files as CommonJS because www/package.json lacks "type": "module", causing
import.meta.dirname to fail at runtime; fix by adding "type": "module" at the
top-level of www/package.json (i.e., "type": "module") so Node treats the
package as ESM, then reinstall/restart any processes or re-run the script to
confirm import.meta.dirname resolves correctly.

@railway-app railway-app bot had a problem deploying to next-prisma-websockets-starter (trpc-sse-and-websockets / trpc-pr-7025) November 24, 2025 02:54 Failure
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b91dd95 and 2336dc8.

📒 Files selected for processing (15)
  • .github/setup/action.yml (1 hunks)
  • .tool-versions (1 hunks)
  • examples/cloudflare-workers/package.json (1 hunks)
  • examples/express-minimal/package.json (1 hunks)
  • examples/express-server/package.json (1 hunks)
  • examples/fastify-server/package.json (1 hunks)
  • examples/lambda-api-gateway/package.json (1 hunks)
  • examples/lambda-url/package.json (1 hunks)
  • examples/lazy-load/package.json (1 hunks)
  • examples/minimal-content-types/server/package.json (1 hunks)
  • examples/minimal-react/server/package.json (1 hunks)
  • examples/minimal/package.json (1 hunks)
  • examples/standalone-server/package.json (1 hunks)
  • examples/vercel-edge-runtime/package.json (1 hunks)
  • package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • examples/lambda-url/package.json
  • examples/express-minimal/package.json
  • examples/standalone-server/package.json
  • package.json
  • examples/lazy-load/package.json
  • examples/express-server/package.json
  • examples/lambda-api-gateway/package.json
  • examples/minimal/package.json
  • examples/cloudflare-workers/package.json
  • examples/fastify-server/package.json
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : For migration testing, exercise both legacy and modern patterns via ctx.rq and ctx.trq within the same test when relevant
Learnt from: barelyhuman
Repo: trpc/trpc PR: 6530
File: packages/upgrade/src/bin/cli.ts:218-222
Timestamp: 2025-02-19T20:31:52.088Z
Learning: The CLI options `trpcFile` and `trpcImportName` in `packages/upgrade/src/bin/cli.ts` are temporary and planned to be removed in favor of using automatically discovered references from the TypeScript program.
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Import both 'trpc/react-query' as rq (legacy) and 'trpc/tanstack-react-query' as trq (modern) when writing migration tests
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Never import from `trpc/*/src`; import from the package root instead
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6789
File: packages/tanstack-react-query/tsdown.config.ts:1-24
Timestamp: 2025-06-09T14:01:20.033Z
Learning: In the tRPC monorepo, packages/tests and packages/upgrade don't need main/module/types fields in their package.json because tests is not distributed and upgrade just exposes a binary.
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Follow import order: test helpers, tRPC test imports, third-party, then relative
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Do NOT import legacy-only helpers like createAppRouter from './__testHelpers' in upgrade-package tests
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Leverage TypeScript strict mode features
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.tsx : Use the JSX runtime (no need to import React for JSX)
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx,md,mdx} : Use camelCase for file names (with exceptions like TRPC/RPC/HTTP/JSON acronyms, .config.js, .d.ts, and tests)
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Separate type imports from value imports
📚 Learning: 2025-06-09T14:01:20.033Z
Learnt from: juliusmarminge
Repo: trpc/trpc PR: 6789
File: packages/tanstack-react-query/tsdown.config.ts:1-24
Timestamp: 2025-06-09T14:01:20.033Z
Learning: In the tRPC monorepo, packages/tests and packages/upgrade don't need main/module/types fields in their package.json because tests is not distributed and upgrade just exposes a binary.

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
  • examples/vercel-edge-runtime/package.json
📚 Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React testing utilities with `import * as React from 'react';`

Applied to files:

  • examples/minimal-react/server/package.json
📚 Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Leverage TypeScript strict mode features

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
  • examples/vercel-edge-runtime/package.json
📚 Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Use proper type guards and optional chaining instead of non-null assertions

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
📚 Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Follow import order: test helpers, tRPC test imports, third-party, then relative

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
📚 Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Prefer array destructuring

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
📚 Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React Query types from `tanstack/react-query` as needed

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
📚 Learning: 2025-09-05T16:48:06.982Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-09-05T16:48:06.982Z
Learning: Applies to **/*.{ts,tsx} : Use `as const` for literal type inference when appropriate

Applied to files:

  • examples/minimal-react/server/package.json
  • examples/minimal-content-types/server/package.json
📚 Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : Do NOT import legacy-only helpers like createAppRouter from './__testHelpers' in upgrade-package tests

Applied to files:

  • examples/vercel-edge-runtime/package.json
📚 Learning: 2025-09-05T15:17:32.520Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/upgrade-tests.mdc:0-0
Timestamp: 2025-09-05T15:17:32.520Z
Learning: Applies to packages/upgrade/**/*.{test,spec,trpc,snap}.tsx : For migration testing, exercise both legacy and modern patterns via ctx.rq and ctx.trq within the same test when relevant

Applied to files:

  • examples/vercel-edge-runtime/package.json
📚 Learning: 2025-09-05T15:16:48.745Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-09-05T15:16:48.745Z
Learning: Applies to **/*.test.ts : Configure server options via the `server` property in `testServerAndClientResource` options

Applied to files:

  • examples/vercel-edge-runtime/package.json
📚 Learning: 2025-09-05T16:48:19.113Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-09-05T16:48:19.113Z
Learning: Applies to {pnpm-lock.yaml,yarn.lock,package-lock.json,bun.lockb} : Use pnpm as the package manager; prefer pnpm-lock.yaml and avoid yarn.lock, package-lock.json, or bun.lockb at the repository root

Applied to files:

  • .github/setup/action.yml
  • .tool-versions
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: E2E-tests (soa)
  • GitHub Check: E2E-tests (vercel-edge-runtime)
  • GitHub Check: E2E-tests (next-prisma-todomvc)
  • GitHub Check: E2E-tests (next-prisma-starter)
  • GitHub Check: E2E-tests (next-minimal-starter)
  • GitHub Check: E2E-tests (cloudflare-workers)
  • GitHub Check: E2E-tests (.experimental/next-app-dir)
  • GitHub Check: E2E-tests (.test/diagnostics-big-router)
  • GitHub Check: E2E-tests (minimal-react)
  • GitHub Check: E2E-tests (.test/internal-types-export)
  • GitHub Check: E2E-tests (express-minimal)
  • GitHub Check: E2E-tests (.test/ssg)
  • GitHub Check: E2E-tests (express-server)
  • GitHub Check: Test a monorepo using built declaration files
  • GitHub Check: Release using pkg.pr.new
  • GitHub Check: E2E-tests (Bun) (bun, ubuntu-latest)
  • GitHub Check: E2E-tests (Deno) (deno-deploy)
  • GitHub Check: typecheck-www
  • GitHub Check: test
  • GitHub Check: Lint and auto-fix
🔇 Additional comments (5)
examples/minimal-react/server/package.json (1)

4-12: Well-executed native TypeScript modernization.

The changes correctly align with the shift to native Node.js TypeScript execution:

  • "type": "module" enables ES modules (required for native TS transpilation).
  • "engines": { "node": "^22.20.0" } ensures the minimum Node version supports --watch with .ts files.
  • "dev" script properly replaces tsx watch with node --watch for native support.
  • Removal of tsx from devDependencies is appropriate.
examples/minimal-content-types/server/package.json (1)

4-12: Consistent modernization pattern maintained.

Identical to examples/minimal-react/server/package.json, this file correctly implements native TypeScript support across the examples directory. The "engines" constraint and module configuration align with the PR's modernization objectives.

.github/setup/action.yml (1)

9-9: ---

Node.js version successfully centralized via package.json.

The change from hard-coded node-version: 22.x to node-version-file: package.json properly centralizes version management. The root package.json declares engines.node: "^22.20.0", which ensures CI uses the same Node version as specified in the project configuration.

examples/vercel-edge-runtime/package.json (2)

5-7: Verify the Node version constraint is appropriate.

The constraint ^22.20.0 requires Node 22+, which is more restrictive than the current LTS (Node 20). Confirm this version requirement is necessary for the TypeScript native execution setup and aligns with your project's support matrix.


11-11: The original review comment is based on incorrect assumptions about Node's capabilities and can be safely ignored.

Node 22 (>= v22.18.0, which includes 22.20.0) has native type stripping enabled by default, allowing Node to run .ts files by removing erasable TypeScript type annotations at runtime. The repository's setup is properly configured for this:

  • tsconfig.json includes "erasableSyntaxOnly": true, explicitly designed for Node's native TypeScript execution
  • All relative imports use explicit .ts extensions (required for Node native TypeScript)
  • Type imports/exports use import type and export type keywords (required for Node native TypeScript)
  • No non-erasable syntax (enums, namespaces, parameter properties, JSX, etc.) is present in the source files
  • devDependencies correctly has tsx removed

The test-dev script will work as intended with node src/client.ts on Node 22.20.0+.

Likely an incorrect or invalid review comment.

@juliusmarminge
Copy link
Member Author

Not sure how to update the node version in Railway

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

"type": "module",
"engines": {
"node": "^22.18.0",
"node": "^22.20.0",
Copy link

Choose a reason for hiding this comment

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

Bug: CommonJS files break with ESM module type

Adding "type": "module" to the root package.json causes all .js files in subdirectories without their own package.json to be interpreted as ESM modules. However, several files in the www directory use CommonJS syntax (module.exports, require(), __dirname), including www/docusaurus.typedoc.js, www/docusaurus.twitterReload.js, www/mdxToJsx.js, www/shikiTwoslash.config.js, www/src/utils/env.js, and files in www/og-image/. These files will fail at runtime with syntax errors when Node.js tries to parse them as ESM modules.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

3 participants