Add TypeScript 7 (tsgo) as fast type-checker alongside TS 6

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
This commit is contained in:
simoleo89
2026-05-11 16:31:51 +00:00
parent 6c9f414028
commit f18c917fc4
5 changed files with 87 additions and 6 deletions
+3 -1
View File
@@ -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",