From 6e344f28fbdb53c6f63c7435fd3b12c476bcb8e9 Mon Sep 17 00:00:00 2001 From: Arda Erzin Date: Thu, 23 Jul 2026 21:21:44 +0200 Subject: [PATCH] chore(frontend): modernize tsconfig, add native TS7 type-check Two production-ready changes plus an opt-in fast type-checker, stacked on the tsc-cleanup work. Both apps stay at 0 errors throughout. 1. tsconfig modernization (real change, toolchain-neutral). Switched oss/ee to the relative-paths, no-baseUrl form. This is the modern standard: classic TS 5.9 accepts it, and it is also what TS7 REQUIRES (it removed baseUrl -- TS5102 -- and disallows non-relative path values -- TS5090). 2. CSS side-effect import typing (real change, additive). Added css-modules.d.ts per app, mirroring packages/css-modules.d.ts, so asset imports are typed. TS7 needs this (TS2882); classic tolerated untyped CSS under moduleResolution:bundler. 3. Opt-in native type-check. Adds @typescript/native-preview (the isolated tsgo binary -- does NOT replace typescript@5.9, so typescript-eslint and next build are untouched) and a type-check:native script. Usable today for a faster local loop: OSS check-to-zero 18.1s (classic) -> 3.7s (native), ~4.9x. Also adds a plain type-check (classic) script; there wasn't one. Verified all four gates green with these changes: native tsgo: oss 0, ee 0 classic tsc: oss 0, ee 0 next build oss: exit 0 (Next resolver handles no-baseUrl) lint oss (typescript-eslint): exit 0 Deferred (not in this PR): making native the ENFORCED gate (CI/pre-commit/next build). The hard blocker is typescript-eslint: TS7.0 shipped without a stable compiler API (7.1 will add one), and npm refuses to install typescript-eslint alongside typescript@7 at all (ERESOLVE) -- so flipping the lint job to native is not yet possible. Whether next build's internal type-check is also blocked is unverified: it depends on whether Next consumes the programmatic API or shells out to the tsc binary. This PR does not touch either gate; it makes the later flip a small change and measures the win now. --- web/ee/css-modules.d.ts | 14 +++++++ web/ee/tsconfig.json | 5 +-- web/oss/css-modules.d.ts | 14 +++++++ web/oss/tsconfig.json | 5 +-- web/package.json | 3 ++ web/pnpm-lock.yaml | 81 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 116 insertions(+), 6 deletions(-) create mode 100644 web/ee/css-modules.d.ts create mode 100644 web/oss/css-modules.d.ts diff --git a/web/ee/css-modules.d.ts b/web/ee/css-modules.d.ts new file mode 100644 index 0000000000..9e33179f57 --- /dev/null +++ b/web/ee/css-modules.d.ts @@ -0,0 +1,14 @@ +/** + * Ambient CSS module declarations for the app. + * Classic tsc tolerates untyped side-effect CSS imports under moduleResolution:bundler; + * the native compiler (TS7) requires a declaration. This mirrors packages/css-modules.d.ts. + */ +declare module "*.module.css" { + const classes: {[key: string]: string} + export default classes +} + +declare module "*.css" { + const content: {[key: string]: string} + export default content +} diff --git a/web/ee/tsconfig.json b/web/ee/tsconfig.json index 487e08594f..6a6ba5034e 100644 --- a/web/ee/tsconfig.json +++ b/web/ee/tsconfig.json @@ -1,10 +1,9 @@ { "extends": "../oss/tsconfig.json", "compilerOptions": { - "baseUrl": "..", "paths": { - "@/oss/*": ["./ee/src/*", "./oss/src/*"], - "@/agenta-oss-common/*": ["./ee/src/*", "./oss/src/*"] + "@/oss/*": ["./src/*", "../oss/src/*"], + "@/agenta-oss-common/*": ["./src/*", "../oss/src/*"] } }, "include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx"], diff --git a/web/oss/css-modules.d.ts b/web/oss/css-modules.d.ts new file mode 100644 index 0000000000..9e33179f57 --- /dev/null +++ b/web/oss/css-modules.d.ts @@ -0,0 +1,14 @@ +/** + * Ambient CSS module declarations for the app. + * Classic tsc tolerates untyped side-effect CSS imports under moduleResolution:bundler; + * the native compiler (TS7) requires a declaration. This mirrors packages/css-modules.d.ts. + */ +declare module "*.module.css" { + const classes: {[key: string]: string} + export default classes +} + +declare module "*.css" { + const content: {[key: string]: string} + export default content +} diff --git a/web/oss/tsconfig.json b/web/oss/tsconfig.json index 80e4dfec6a..f1ca26e6a6 100644 --- a/web/oss/tsconfig.json +++ b/web/oss/tsconfig.json @@ -14,10 +14,9 @@ "isolatedModules": true, "jsx": "preserve", "incremental": true, - "baseUrl": ".", "paths": { - "@/oss/*": ["src/*", "src/lib/noop/index.tsx"], - "@/agenta-oss-common/*": ["../ee/src/*", "src/*", "src/lib/noop/index.tsx"] + "@/oss/*": ["./src/*", "./src/lib/noop/index.tsx"], + "@/agenta-oss-common/*": ["../ee/src/*", "./src/*", "./src/lib/noop/index.tsx"] } }, "include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx"], diff --git a/web/package.json b/web/package.json index 88dc86f59d..511be149c2 100644 --- a/web/package.json +++ b/web/package.json @@ -25,6 +25,7 @@ "@next/eslint-plugin-next": "15.5.18", "@typescript-eslint/eslint-plugin": "^8.61.0", "@typescript-eslint/parser": "^8.61.0", + "@typescript/native-preview": "7.0.0-dev.20260707.2", "eslint": "^9.39.4", "eslint-config-next": "15.5.18", "eslint-config-prettier": "^10.1.8", @@ -51,6 +52,8 @@ "dev-oss": "turbo run dev --filter=@agenta/oss", "lint": "turbo run lint", "lint-fix": "turbo run lint -- --fix", + "type-check": "pnpm --filter @agenta/oss exec tsc --noEmit && pnpm --filter @agenta/ee exec tsc --noEmit", + "type-check:native": "pnpm --filter @agenta/oss exec tsgo --noEmit && pnpm --filter @agenta/ee exec tsgo --noEmit", "test:revision-centric": "tsx --tsconfig oss/tsconfig.json oss/tests/datalayer/test-revision-centric.ts", "test:apps": "tsx --tsconfig oss/tsconfig.json oss/tests/datalayer/test-apps.ts", "test:environments": "tsx --tsconfig oss/tsconfig.json oss/tests/datalayer/test-environments.ts", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 0b7e7b6bec..735ba988d8 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -70,6 +70,9 @@ importers: '@typescript-eslint/parser': specifier: ^8.61.0 version: 8.61.0(eslint@9.39.4(jiti@2.7.0))(typescript@5.9.3) + '@typescript/native-preview': + specifier: 7.0.0-dev.20260707.2 + version: 7.0.0-dev.20260707.2 eslint: specifier: ^9.39.4 version: 9.39.4(jiti@2.7.0) @@ -3703,6 +3706,53 @@ packages: resolution: {integrity: sha512-QVLZu3ZPQEE+HICQyAMZ2yLQhxf0meY/wx6Hx14YcTNj13JB3qHlX3lJ02L3fLGHgERRH71kvYDwiXIguT3AjQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-wny2pgKjGbiZtnOIHVa3tXC1UfDqxNEFzyPGmiqybedG8hipG2Nfp0l5UxbaKCjkLacUpH/W5bP2hBOMVhCOzg==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [darwin] + + '@typescript/native-preview-darwin-x64@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-Afc7M5zOwo+GpfcYwz5Z8HMB2tPVsui7nNIqEuuFB73MPdVqNn/Wmpe4tP4MRri0AtJnJknoHBaTJ/VDAp/Jhw==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [darwin] + + '@typescript/native-preview-linux-arm64@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-iITBa2WjjTI5N9t5l7Z4KoOSI+2zBlhbvFzsD/f8qX8QoKjz/Y4DPyBDgezYi8nkqjjksbgSOJ3/ykzhwrB9cg==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [linux] + + '@typescript/native-preview-linux-arm@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-hJm/UOqZTr9FHmR7uNm8VGX4oKtfWk0Jem0zPeJFNC8ckGUfSBueyiEYMZB+XmRc1aG4x1E46y3CplP4CLHvGQ==} + engines: {node: '>=16.20.0'} + cpu: [arm] + os: [linux] + + '@typescript/native-preview-linux-x64@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-du0dzi6y97Po5vDNdPJTyyijHCpaS22JLRnKZEJXBDaO9gCIymOv/5QQokFRuOlQm0bWl3i9PF4OVdGP6uAOQA==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [linux] + + '@typescript/native-preview-win32-arm64@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-SsAwfhyHJ1akgBc+99z4+hwdbHsdWaKB8EwCNIMA6JfSLMeUjffrYvxu+vfMyxVtOVOz7RrRXRoiDiu4a2sCtg==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [win32] + + '@typescript/native-preview-win32-x64@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-DL4u27stv0fo71sVhOzHSwE+YMZsbBijVI+kg5dLDLilSH79WFTJ8RSQ46vJrCMt+Gjlv/JOZP1PuLJDfioYeQ==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [win32] + + '@typescript/native-preview@7.0.0-dev.20260707.2': + resolution: {integrity: sha512-oUGp+Rep/hqMhPunyinsALUwSlzHINSxitifPiSaeqoKOKD2OlR9NE3TaPqwsl4NlGslsOSUXI1JotWQzpYCPg==} + engines: {node: '>=16.20.0'} + hasBin: true + '@ungap/structured-clone@1.3.1': resolution: {integrity: sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==} @@ -9638,6 +9688,37 @@ snapshots: '@typescript-eslint/types': 8.61.0 eslint-visitor-keys: 5.0.1 + '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview-darwin-x64@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview-linux-arm64@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview-linux-arm@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview-linux-x64@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview-win32-arm64@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview-win32-x64@7.0.0-dev.20260707.2': + optional: true + + '@typescript/native-preview@7.0.0-dev.20260707.2': + optionalDependencies: + '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260707.2 + '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260707.2 + '@typescript/native-preview-linux-arm': 7.0.0-dev.20260707.2 + '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260707.2 + '@typescript/native-preview-linux-x64': 7.0.0-dev.20260707.2 + '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260707.2 + '@typescript/native-preview-win32-x64': 7.0.0-dev.20260707.2 + '@ungap/structured-clone@1.3.1': {} '@unrs/resolver-binding-android-arm-eabi@1.12.2':