From f18c917fc43ec937ca1d96fedaddfb0b9e574794 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Mon, 11 May 2026 16:31:51 +0000 Subject: [PATCH] Add TypeScript 7 (tsgo) as fast type-checker alongside TS 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TypeScript 7 is the Go-native rewrite of tsc, ~10x faster but only distributed as @typescript/native-preview daily builds at the time of writing (npm typescript@latest is still 6.0.3). Add it as a non-disruptive type-check tool: yarn typecheck → tsgo --noEmit. Vite still uses esbuild for transpilation, ESLint still uses TS 6 through @typescript-eslint v8, IDEs continue using their bundled TS. This commit only adds a type-check tool — nothing replaces. Required tsconfig.json adjustments for TS 7 compatibility (still valid for TS 6): - Drop baseUrl: "./src" (removed in TS 7). The codebase has no bare/non-relative imports that depended on it; all imports are relative or aliased. - Drop downlevelIteration: true (removed in TS 7; target es2022 doesn't need it). - moduleResolution: "node" → "bundler" (TS 7 dropped node10; bundler is the right mode for Vite anyway). - paths "@layout/*" entries now use leading "./" (TS 7 disallows non-relative path mappings). Add "@/*" → "./src/*" to match the Vite alias used in some components. Other TS 7 adjustments: - src/react-app-env.d.ts: add module declarations for *.css/.scss/.sass side-effect imports (TS 7 with bundler resolution requires them) + Window.NitroConfig / Window.NitroSecureApiUrl globals which were used in App.tsx without a declaration. - src/common/Popover.tsx: explicit `import { JSX } from 'react'` because TS 7 dropped the implicit global JSX namespace. Verification: - yarn eslint still passes (TS 6 / @typescript-eslint v8 happy with the migrated config). - yarn typecheck (tsgo) runs and reports only cascading errors rooted in the missing @nitrots/nitro-renderer sibling repo (environmental, not introduced here). https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q --- package.json | 4 +++- src/common/Popover.tsx | 2 +- src/react-app-env.d.ts | 30 ++++++++++++++++++++++++++ tsconfig.json | 9 ++++---- yarn.lock | 48 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 402870c..cc2c81b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "start": "vite --host", "build": "vite build && node scripts/minify-dist.mjs", "build:prod": "npx browserslist@latest --update-db && yarn build", - "eslint": "eslint ./src" + "eslint": "eslint ./src", + "typecheck": "tsgo --noEmit" }, "dependencies": { "@babel/runtime": "^7.29.2", @@ -36,6 +37,7 @@ "@types/react-dom": "^19.2.3", "@typescript-eslint/eslint-plugin": "^8.59.1", "@typescript-eslint/parser": "^8.59.1", + "@typescript/native-preview": "^7.0.0-dev.20260509.2", "@vitejs/plugin-react": "^6.0.1", "babel-plugin-react-compiler": "^1.0.0", "eslint": "^10.2.1", diff --git a/src/common/Popover.tsx b/src/common/Popover.tsx index 25267fa..46aeece 100644 --- a/src/common/Popover.tsx +++ b/src/common/Popover.tsx @@ -1,4 +1,4 @@ -import { FC, PropsWithChildren, useEffect, useRef, useState } from 'react'; +import { FC, JSX, PropsWithChildren, useEffect, useRef, useState } from 'react'; export const ReactPopover: FC; + NitroSecureApiUrl?: string; +} + interface ImportMeta { glob: (pattern: string, options?: { eager?: boolean; import?: string }) => Record; diff --git a/tsconfig.json b/tsconfig.json index e5c6ba1..04ef8b6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": "./src", "target": "es2022", "lib": [ "dom", @@ -12,18 +11,20 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": false, - "downlevelIteration": true, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": false, "module": "ES2022", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "paths": { "@layout/*": [ - "layout/*" + "./src/layout/*" + ], + "@/*": [ + "./src/*" ] } }, diff --git a/yarn.lock b/yarn.lock index b347ea0..62b1fef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1062,6 +1062,54 @@ "@typescript-eslint/types" "8.59.2" eslint-visitor-keys "^5.0.0" +"@typescript/native-preview-darwin-arm64@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260509.2.tgz#e759c5815bcc7d1605da78c63d3960c366b24d5c" + integrity sha512-oG9KahiCpx4q70Ood/rRJhYio4oIMHEHfX0g0LhfenlSIjIonitZWjUmUVG9N9q1ev9QWcM8pWpDrGGP0Osp3Q== + +"@typescript/native-preview-darwin-x64@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260509.2.tgz#70750de45f9791972eaa0d2054eec5964657f52a" + integrity sha512-xdEkp23Gu8I7PJCMmSMYtSLX76NKODWj74AoWFPi6MM59ICsjnTSqZf/HmXKSvuNZ5MGb4CMpP3c40dLjGB2PQ== + +"@typescript/native-preview-linux-arm64@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260509.2.tgz#e81a79ddd39efe42a872b0e5191fdbd0f80a023a" + integrity sha512-rd+bMRtUAFBClOAKi9p2rOu6jPmnrjZVljoFyxHw+6bIRLerEQlxP+nIH1olC3HOZPyZ6/x75WtfzTHYeqffiQ== + +"@typescript/native-preview-linux-arm@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260509.2.tgz#c05f9d7e6a546f2d2844808535bc216753913bba" + integrity sha512-ar5HN/V/4HLF4FZCoVVFj+ET1Soi758hb4WhhzYQfSUXQ/bpVGUGP86JAy8EhVMoeN6qxqWet93MkLSszJOIVg== + +"@typescript/native-preview-linux-x64@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260509.2.tgz#64bc09d219b194cbc8e40fa3dec973ee63585844" + integrity sha512-lB26mGzdolYIZiOdBII8roVJCxCUR8zkYszvvHyjB1IPs7d5fmOhT6OzI1zYPYujiSRJi4HVYM1iXTcIfp7KDg== + +"@typescript/native-preview-win32-arm64@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260509.2.tgz#14341a0a6561107fad33e0686bd267b4775b120e" + integrity sha512-gH3UmtyxHiRNEP0LgQXCVlB5+ZN/U+/Z7jM/zULQtTOxIIFK3Y4b8gbGLvP7uW3u2cqYOg2hc2nuN8OdsCmOig== + +"@typescript/native-preview-win32-x64@7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260509.2.tgz#41a91f82067717781c47e5698bff0d1abb14ac51" + integrity sha512-kZV0Vh64hp10saOghPlFZE1qahonqvRgU3iubt8pUY4XLe8IQIofwWCN5vzNNeULE4W4mRtAJbHuvP/muOFomw== + +"@typescript/native-preview@^7.0.0-dev.20260509.2": + version "7.0.0-dev.20260509.2" + resolved "https://registry.yarnpkg.com/@typescript/native-preview/-/native-preview-7.0.0-dev.20260509.2.tgz#19767f26410f7a211384b9c77e5d53893cc489c5" + integrity sha512-JAJpEX0yBaEle2zzbX5z9QAhmEfML1SyQafLwbKCdcOtnkGdk5xD8NKIVxq+nTwYjRwuV7kKnQ+fqU3gpWY0qQ== + optionalDependencies: + "@typescript/native-preview-darwin-arm64" "7.0.0-dev.20260509.2" + "@typescript/native-preview-darwin-x64" "7.0.0-dev.20260509.2" + "@typescript/native-preview-linux-arm" "7.0.0-dev.20260509.2" + "@typescript/native-preview-linux-arm64" "7.0.0-dev.20260509.2" + "@typescript/native-preview-linux-x64" "7.0.0-dev.20260509.2" + "@typescript/native-preview-win32-arm64" "7.0.0-dev.20260509.2" + "@typescript/native-preview-win32-x64" "7.0.0-dev.20260509.2" + "@vitejs/plugin-react@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-6.0.1.tgz#d9113b71a0a592714913eafd9e5e63bcafd0ff15"