fix: web build typescript errors

- Drop tsconfig.node.json: composite + noEmit conflict, and the
  vite.config.ts doesn't need its own project / node types.
- Inline vite.config.ts in the main tsconfig include list.
- Switch web build from `tsc -b` to `tsc --noEmit` since there are
  no project references anymore.
- Make b64urlDecode return Uint8Array<ArrayBuffer> so its output
  is accepted by crypto.subtle.verify under stricter lib types.
- Cast the Pages EventContext to ExecutionContext when forwarding
  to Hono; props is unused at runtime.

https://claude.ai/code/session_01TPBqgcSJMppgrpiq7fLywL
This commit is contained in:
Claude 2026-05-03 23:56:44 +00:00
parent a1ebc0725b
commit 89b1221706
No known key found for this signature in database
5 changed files with 6 additions and 17 deletions

View File

@ -77,11 +77,12 @@ async function verifyAccessJwt(
return valid ? payload : null;
}
function b64urlDecode(s: string): Uint8Array {
function b64urlDecode(s: string): Uint8Array<ArrayBuffer> {
const pad = s.length % 4 === 0 ? '' : '='.repeat(4 - (s.length % 4));
const b64 = (s + pad).replace(/-/g, '+').replace(/_/g, '/');
const bin = atob(b64);
const out = new Uint8Array(bin.length);
const buf = new ArrayBuffer(bin.length);
const out = new Uint8Array(buf);
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
return out;
}

View File

@ -4,4 +4,4 @@ import type { AppEnv } from '@leetete/api/env';
const app = createApp();
export const onRequest: PagesFunction<AppEnv> = (ctx) =>
app.fetch(ctx.request, ctx.env, ctx);
app.fetch(ctx.request, ctx.env, ctx as unknown as ExecutionContext);

View File

@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build": "tsc --noEmit && vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"deploy": "wrangler pages deploy dist --project-name stefanieeleandro",

View File

@ -6,6 +6,5 @@
"noEmit": true,
"types": ["vite/client", "@cloudflare/workers-types"]
},
"include": ["src/**/*", "functions/**/*"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": ["src/**/*", "functions/**/*", "vite.config.ts"]
}

View File

@ -1,11 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"noEmit": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
},
"include": ["vite.config.ts"]
}