From c633ca3f3f233781f11049898d9da238c1bca740 Mon Sep 17 00:00:00 2001 From: Sofiane Date: Wed, 17 Jun 2026 00:42:51 +0200 Subject: [PATCH] fix(api): make the relayer typecheck under Vercel's function build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vercel's @vercel/node type-checks api/onboard.ts by discovering the nearest tsconfig from the function dir (ts.findConfigFile). The repo only had a non-standard site/tsconfig.api.json, never read by Vercel, so the function was checked with the app-style resolution (no node types) — surfacing 8 errors: - 5x 'Cannot find name process' (types field excluded @types/node) - viem overload unions degraded (abi: any -> readContract wanted authorizationList, sendTransaction wanted kzg) These were non-fatal (deploy still succeeded) but dirtied the build. Fix: move the api tsconfig to site/api/tsconfig.json (the location @vercel/node discovers) and add an idiomatic /// to the function. Under this config viem's abitype resolves -> typed abi -> correct overloads. Verified: tsc auto-discovery from api/ is clean; typecheck:api, lint, build all green. --- site/api/onboard.ts | 1 + site/{tsconfig.api.json => api/tsconfig.json} | 2 +- site/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename site/{tsconfig.api.json => api/tsconfig.json} (92%) diff --git a/site/api/onboard.ts b/site/api/onboard.ts index dd11cc0..e833785 100644 --- a/site/api/onboard.ts +++ b/site/api/onboard.ts @@ -1,3 +1,4 @@ +/// import type { VercelRequest, VercelResponse } from "@vercel/node"; import { createPublicClient, diff --git a/site/tsconfig.api.json b/site/api/tsconfig.json similarity index 92% rename from site/tsconfig.api.json rename to site/api/tsconfig.json index a9842a1..8b5388f 100644 --- a/site/tsconfig.api.json +++ b/site/api/tsconfig.json @@ -11,5 +11,5 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true }, - "include": ["api"] + "include": ["**/*.ts"] } diff --git a/site/package.json b/site/package.json index cc7e799..cda7f60 100644 --- a/site/package.json +++ b/site/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", - "typecheck:api": "tsc -p tsconfig.api.json", + "typecheck:api": "tsc -p api/tsconfig.json", "lint": "eslint .", "preview": "vite preview" },