From 77224dea0fd029060e02fe0965ad22675dc087c2 Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Wed, 11 Nov 2026 18:31:04 +0000 Subject: [PATCH] Update TypeScript to v6 Drop baseUrl from tsconfig.json: v6 deprecates it (TS5101) and the styled-system path mapping is already relative to the tsconfig. Typecheck tsconfig.node.json (vite.config.ts, panda.config.ts) as part of `npm run typecheck`. It was not checked by any script and had drifted: - vitest/config no longer exports UserConfig; use ViteUserConfig. - process.env.BASE_URL is possibly undefined now that strict is the default. A staged build without BASE_URL previously threw at config load and now gets an undefined PWA cache id, as unstaged builds do. - panda.config.ts imports src/deployment/default/panda-preset.ts, so that file moves from the app project to the node project (a file in both fails with TS6305). Also for tsconfig.node.json: write the composite build info to node_modules/.tmp rather than the repo root, and list "types": ["node"] explicitly as v6 no longer loads @types/* automatically. --- package-lock.json | 8 ++++---- package.json | 4 ++-- tsconfig.json | 3 ++- tsconfig.node.json | 10 ++++++++-- vite.config.ts | 8 ++++---- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 90f226099..ad05a3df3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,7 +70,7 @@ "jsdom": "^30.1.3", "playwright": "^1.58.2", "prettier": "2.3.2", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "vite": "^7.3.1", "vite-plugin-pwa": "^1.0.0", "vite-plugin-svgr": "^4.5.0", @@ -11601,9 +11601,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package.json b/package.json index f4076ca84..b2df235cb 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "jsdom": "^30.1.3", "playwright": "^1.58.2", "prettier": "2.3.2", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "vite": "^7.3.1", "vite-plugin-pwa": "^1.0.0", "vite-plugin-svgr": "^4.5.0", @@ -99,7 +99,7 @@ "lint": "eslint . --max-warnings 0", "format": "prettier --write src", "format:check": "prettier --check src", - "typecheck": "tsc --noEmit", + "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json", "pretypecheck": "npm run generate", "typecheck:watch": "tsc --noEmit --watch", "test": "vitest", diff --git a/tsconfig.json b/tsconfig.json index b49432f75..2f28148c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ /* Bundler mode */ "moduleResolution": "bundler", - "baseUrl": ".", "paths": { "styled-system/*": ["./styled-system/*"] }, @@ -26,5 +25,7 @@ "types": ["vitest/globals", "node", "vite-plugin-pwa/client"] }, "include": ["src"], + // Build-time config, owned by tsconfig.node.json; a file cannot be in both. + "exclude": ["src/deployment/default/panda-preset.ts"], "references": [{ "path": "./tsconfig.node.json" }] } diff --git a/tsconfig.node.json b/tsconfig.node.json index adc05cd1e..12c2b5002 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,10 +1,16 @@ { "compilerOptions": { "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "skipLibCheck": true, "module": "ESNext", "moduleResolution": "bundler", - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "types": ["node"] }, - "include": ["vite.config.ts", "panda.config.ts"] + "include": [ + "vite.config.ts", + "panda.config.ts", + "src/deployment/default/panda-preset.ts" + ] } diff --git a/vite.config.ts b/vite.config.ts index 00bfd95e4..4b35e8e78 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,7 +11,7 @@ import { } from "vite"; import { VitePWA } from "vite-plugin-pwa"; import svgr from "vite-plugin-svgr"; -import { configDefaults, defineConfig, UserConfig } from "vitest/config"; +import { configDefaults, defineConfig, ViteUserConfig } from "vitest/config"; // Browser-support floor (esbuild/lightningcss target syntax) for JS // (build.target) and CSS (build.cssTarget). Keep in sync with the @@ -43,7 +43,7 @@ const pwaCacheId = process.env.STAGE === "BETA" || process.env.STAGE === "STAGING" || process.env.STAGE === "REVIEW" - ? process.env.BASE_URL.replaceAll("/", "") + ? process.env.BASE_URL?.replaceAll("/", "") : undefined; // There are third-party options but seems better to just depend on ejs. @@ -86,7 +86,7 @@ const viteRemoveManifestPlugin = (): Plugin => ({ export default defineConfig(({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; - const unitTest: UserConfig["test"] = { + const unitTest: ViteUserConfig["test"] = { globals: true, exclude: [...configDefaults.exclude, "**/e2e/**"], environment: "jsdom", @@ -102,7 +102,7 @@ export default defineConfig(({ mode }) => { ), }, }; - const config: UserConfig = { + const config: ViteUserConfig = { base: process.env.BASE_URL ?? "/", build: { outDir: "build",