mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
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:
+3
-1
@@ -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",
|
||||
|
||||
@@ -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<PropsWithChildren<{
|
||||
content: JSX.Element;
|
||||
|
||||
Vendored
+30
@@ -9,6 +9,36 @@ declare module '*.gif' {
|
||||
export default src;
|
||||
}
|
||||
|
||||
declare module '*.jpg' {
|
||||
const src: string;
|
||||
export default src;
|
||||
}
|
||||
|
||||
declare module '*.jpeg' {
|
||||
const src: string;
|
||||
export default src;
|
||||
}
|
||||
|
||||
declare module '*.svg' {
|
||||
const src: string;
|
||||
export default src;
|
||||
}
|
||||
|
||||
declare module '*.webp' {
|
||||
const src: string;
|
||||
export default src;
|
||||
}
|
||||
|
||||
declare module '*.css';
|
||||
declare module '*.scss';
|
||||
declare module '*.sass';
|
||||
|
||||
interface Window
|
||||
{
|
||||
NitroConfig?: Record<string, unknown>;
|
||||
NitroSecureApiUrl?: string;
|
||||
}
|
||||
|
||||
interface ImportMeta
|
||||
{
|
||||
glob: (pattern: string, options?: { eager?: boolean; import?: string }) => Record<string, string>;
|
||||
|
||||
+5
-4
@@ -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/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user