Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(dx): use tsgo for typechecking + parallel build command (#11682)

Nimardcee2e9e39ee
diff --git a/.gitignore b/.gitignore
index 4c5883377d..7c003fd205 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@ migrate
# next.js
/.next/
+/.next-check/
/out/
next-env.d.ts
@@ -64,6 +65,7 @@ node_modules
**/node_modules
**/dist
**/.next/*
+**/.next-check/*
**/.turbo/*
.yarn
.turbo
diff --git a/CLAUDE.md b/CLAUDE.md
index 6bab82f103..8fb97abdc1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -72,9 +72,11 @@ pnpm run infra:dev:up # Start Docker services (PostgreSQL, ClickHouse, Redi
pnpm run infra:dev:down # Stop Docker services
```
-### Building
+### Building & Type Checking
```sh
pnpm --filter=PACKAGE_NAME run build # Runs the build command, will show real typescript errors etc.
+pnpm tc # Fast typecheck across all packages (alias for pnpm typecheck)
+pnpm build:check # Full Next.js build to alternate dir (can run parallel with dev server)
```
### Testing in Web Package
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3482fc8899..de5082027b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -180,6 +180,8 @@ pnpm run db:seed:examples
pnpm install
pnpm run dev
pnpm --filter=web run dev # execute command only in one package
+ pnpm tc # fast typecheck all packages
+ pnpm build:check # Full Next.js build to alternate dir (can run parallel with dev server)
```
In the root `package.json`, you can find scripts which are executed with turbo e.g. `turbo run dev`. These scripts are executed with the help of Turbo. Turbo executes the commands in all packages taking care of the correct order of execution. Task definitions can be found in the `turbo.config.js` file.
diff --git a/ee/package.json b/ee/package.json
index 7abb1b4e64..2bce0bf983 100644
--- a/ee/package.json
+++ b/ee/package.json
@@ -19,6 +19,8 @@
},
"scripts": {
"build": "tsc",
+ "build:check": "tsc",
+ "typecheck": "dotenv -e ../../.env -- tsgo --noEmit --skipLibCheck --incremental --tsBuildInfoFile .tsbuildinfo",
"dev": "tsc --watch",
"lint": "eslint . --cache --cache-location dist/.eslintcache --max-warnings 0",
"lint:fix": "eslint . --cache --cache-location dist/.eslintcache --fix"
@@ -36,6 +38,7 @@
"@repo/typescript-config": "workspace:*",
"@types/node": "^24.3.0",
"@typescript-eslint/parser": "^8.50.1",
+ "@typescript/native-preview": "7.0.0-dev.20260122.3",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-config-standard": "^17.1.0",
diff --git a/package.json b/package.json
index 66b3a8c225..cfb9957e87 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,9 @@
"dx-f": "pnpm i && pnpm run infra:dev:prune && pnpm run infra:dev:up --pull always && pnpm --filter=shared run db:reset:test && pnpm --filter=shared run db:reset -f && SKIP_CONFIRM=1 pnpm --filter=shared run ch:reset && pnpm --filter=shared run db:seed:examples && pnpm run dev",
"dx:skip-infra": "pnpm i && pnpm --filter=shared run db:reset:test && pnpm --filter=shared run db:reset && pnpm --filter=shared run ch:reset && pnpm --filter=shared run db:seed:examples && pnpm run dev",
"build": "turbo run build",
+ "build:check": "turbo run build:check",
+ "typecheck": "turbo run typecheck",
+ "tc": "turbo run typecheck",
"start": "turbo run start",
"dev": "turbo run dev",
"dev:worker": "turbo run dev --filter=worker",
diff --git a/packages/shared/package.json b/packages/shared/package.json
index 02f336a498..2914ede40c 100644
--- a/packages/shared/package.json
+++ b/packages/shared/package.json
@@ -36,6 +36,8 @@
},
"scripts": {
"build": "tsc",
+ "build:check": "tsc",
+ "typecheck": "dotenv -e ../../.env -- tsc --noEmit --incremental --tsBuildInfoFile .tsbuildinfo",
"dev": "tsc --watch",
"lint": "eslint . --cache --cache-location dist/.eslintcache --max-warnings 0",
"lint:fix": "eslint . --cache --cache-location dist/.eslintcache --fix",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 59ed3294f5..b4f2d0b650 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -77,6 +77,9 @@ importers:
'@typescript-eslint/parser':
specifier: ^8.50.1
+ '@typescript/native-preview':
+ specifier: 7.0.0-dev.20260122.3
+ version: 7.0.0-dev.20260122.3
eslint:
specifier: ^9.39.2
version: 9.39.2([email protected])
@@ -849,6 +852,9 @@ importers:
'@typescript-eslint/parser':
specifier: ^8.50.1
+ '@typescript/native-preview':
+ specifier: 7.0.0-dev.20260122.3
+ version: 7.0.0-dev.20260122.3
autoprefixer:
specifier: ^10.4.19
version: 10.4.19([email protected])
@@ -1039,6 +1045,9 @@ importers:
'@typescript-eslint/parser':
specifier: ^8.50.1
+ '@typescript/native-preview':
+ specifier: 7.0.0-dev.20260122.3
+ version: 7.0.0-dev.20260122.3
eslint:
specifier: ^9.39.2
version: 9.39.2([email protected])
@@ -6303,6 +6312,45 @@ packages:
resolution: {integrity: sha512-IrDKrw7pCRUR94zeuCSUWQ+w8JEf5ZX5jl/e6AHGSLi1/zIr0lgutfn/7JpfCey+urpgQEdrZVYzCaVVKiTwhQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-VVr3SHMzQTeQhtSlLnSjMK8kaE3f2SmOOkvuC8qGHQ2W28RF2ZvIFhbJgCAI++8S/L0GufF+ISA50M41yRiNOA==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-3G2+xwNXu7cJtMavpuoJ3EdO0Dk1okrKQ28VNKrkV61+8Ei5Z6hNSU+rmEw7fn83EYGXMBpq8znO/U/Gvc3BDg==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-W5Ac4aYkKHf8ytEk969CjpWOT8WjVI7rbx5cwMCPKOLFnTyz4MJ2rK70IXWCssnZtz9KuSBdktAjhq7O1utF3w==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-q/BqemIAcP7MjmtG8xXFnbC/MuCxzSL03kN2IrOybxetspCTEi5gKVLEm81LZUCLt3bVgBeVu1sSrQEGhunM6w==}
+ cpu: [arm]
+ os: [linux]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-N+yHKKuaMKjKMtxDBj7fK1nxbbVjme30kEoRQnYTPCwX7mwCbGy/8WffhgNV+qCxtdxp5P0+iQFr8X/dxjWS3w==}
+ cpu: [x64]
+ os: [linux]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-QTT+YpIgPLl0TkVu2M/hGGR8MjVvfXDqA57R8ILS8+QjpzE+EB7P73MR7OAeCs+hI+Kw3OERoH3WtmdyHlYf5w==}
+ cpu: [arm64]
+ os: [win32]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-Q6N5274oq3WiSlNoox9uC7YNEivkbwzYintiAzb45d1rsoknNgkCMRecdEC1+kMg6uNnWrmHELg1yJuLaaIinA==}
+ cpu: [x64]
+ os: [win32]
+
+ '@typescript/[email protected]':
+ resolution: {integrity: sha512-/G74DRDNrq2pkBjne3aGzycdy2bKa2Hs4DrkLMRq+cDODjyqvHJIZV7hjRRYph3cvGnd0bFd5G6LE5zNp+ap8w==}
+ hasBin: true
+
resolution: {integrity: sha512-YzNwkm0AbPv1EXhCHYR5v0nqfemG2jEB0Z3Att4rBYqKrlG7AA9Rhjc3IyBaOzsBu18wtrp9/+uhTyu7TXSRng==}
peerDependencies:
@@ -7774,10 +7822,6 @@ packages:
resolution: {integrity: sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
engines: {node: '>= 0.4'}
@@ -17301,7 +17345,7 @@ snapshots:
'@opentelemetry/sdk-logs': 0.53.0(@opentelemetry/[email protected])
'@opentelemetry/sdk-metrics': 1.26.0(@opentelemetry/[email protected])
'@opentelemetry/sdk-trace-base': 1.26.0(@opentelemetry/[email protected])
- protobufjs: 7.4.0
+ protobufjs: 7.5.4
'@opentelemetry/[email protected](@opentelemetry/[email protected])':
dependencies:
@@ -20405,6 +20449,37 @@ snapshots:
'@typescript-eslint/types': 8.50.1
eslint-visitor-keys: 4.2.1
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optional: true
+
+ '@typescript/[email protected]':
+ optionalDependencies:
+ '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260122.3
+ '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260122.3
+ '@typescript/native-preview-linux-arm': 7.0.0-dev.20260122.3
+ '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260122.3
+ '@typescript/native-preview-linux-x64': 7.0.0-dev.20260122.3
+ '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260122.3
+ '@typescript/native-preview-win32-x64': 7.0.0-dev.20260122.3
+
'@uiw/[email protected](@codemirror/[email protected](@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@lezer/[email protected]))(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])':
dependencies:
'@codemirror/autocomplete': 6.17.0(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@lezer/[email protected])
@@ -22017,10 +22092,6 @@ snapshots:
unbox-primitive: 1.1.0
which-typed-array: 1.1.19
- dependencies:
- get-intrinsic: 1.3.0
-
@@ -22931,7 +23002,7 @@ snapshots:
dependencies:
- es-define-property: 1.0.0
+ es-define-property: 1.0.1
dependencies:
@@ -25470,7 +25541,7 @@ snapshots:
dependencies:
pg-connection-string: 2.7.0
pg-pool: 3.7.0([email protected])
- pg-protocol: 1.7.0
+ pg-protocol: 1.10.3
pg-types: 2.2.0
pgpass: 1.0.5
optionalDependencies:
diff --git a/turbo.json b/turbo.json
index 9c99ebeecb..48b3a9696c 100644
--- a/turbo.json
+++ b/turbo.json
@@ -35,13 +35,24 @@
"dependsOn": ["db:generate"]
},
"db:generate": {
- "cache": false,
+ "inputs": ["packages/shared/prisma/schema.prisma"],
+ "cache": true,
"dependsOn": ["^db:generate"]
},
"lint": {
"cache": true,
"outputs": []
},
+ "typecheck": {
+ "dependsOn": ["db:generate"],
+ "cache": true,
+ "outputs": []
+ },
+ "build:check": {
+ "dependsOn": ["db:generate", "^build"],
+ "outputs": [".next-check/**", "!.next-check/cache/**"],
+ "cache": true
+ },
"test": {
"dependsOn": ["^test", "db:generate"],
"cache": true
diff --git a/web/next.config.mjs b/web/next.config.mjs
index d8f7653f43..ae7fbca024 100644
--- a/web/next.config.mjs
+++ b/web/next.config.mjs
@@ -48,6 +48,8 @@ const reportToHeader = {
/** @type {import("next").NextConfig} */
const nextConfig = {
+ // Allow building to alternate directory for parallel build checks while dev server runs
+ distDir: process.env.NEXT_DIST_DIR || ".next",
staticPageGenerationTimeout: 500, // default is 60. Required for build process for amd
transpilePackages: ["@langfuse/shared", "vis-network/standalone"],
reactStrictMode: true,
diff --git a/web/package.json b/web/package.json
index 6a32d711e3..990e1b6080 100644
--- a/web/package.json
+++ b/web/package.json
@@ -8,6 +8,8 @@
},
"scripts": {
"build": "INLINE_RUNTIME_CHUNK=false dotenv -e ../.env -- next build",
+ "build:check": "NEXT_DIST_DIR=.next-check INLINE_RUNTIME_CHUNK=false dotenv -e ../.env -- next build",
+ "typecheck": "dotenv -e ../.env -- tsgo -p tsconfig.build.json --noEmit --skipLibCheck --incremental --tsBuildInfoFile .tsbuildinfo",
"dev": "dotenv -e ../.env -- next dev --turbopack",
"dev:http": "dotenv -e ../.env -- next dev --experimental-https --experimental-https-key ./localhost+1-key.pem --experimental-https-cert ./localhost+1.pem",
"lint": "dotenv -e ../.env -- eslint . --cache --cache-location .next/cache/eslint/ --max-warnings 0",
@@ -192,6 +194,7 @@
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^8.50.1",
"@typescript-eslint/parser": "^8.50.1",
+ "@typescript/native-preview": "7.0.0-dev.20260122.3",
"autoprefixer": "^10.4.19",
"cross-env": "^7.0.3",
"dotenv-cli": "^7.4.2",
diff --git a/web/tsconfig.build.json b/web/tsconfig.build.json
new file mode 100644
index 0000000000..ba7a401832
--- /dev/null
+++ b/web/tsconfig.build.json
@@ -0,0 +1,10 @@
+{
+ "extends": "./tsconfig.json",
+ "exclude": [
+ "node_modules",
+ "sdk",
+ "src/__tests__/**",
+ "**/*.clienttest.*",
+ "**/*.servertest.*"
+ ]
+}
diff --git a/web/tsconfig.json b/web/tsconfig.json
index 7bc1a6be9a..df17557e73 100644
--- a/web/tsconfig.json
+++ b/web/tsconfig.json
@@ -10,21 +10,27 @@
}
],
"paths": {
- "@/*": ["./*"]
+ "@/*": [
+ "./*"
+ ]
},
"strictNullChecks": true
},
- "exclude": ["node_modules", "sdk"],
+ "exclude": [
+ "node_modules",
+ "sdk"
+ ],
"include": [
- "src",
- "next-env.d.ts",
- ".next/types/**/*.ts",
- ".eslintrc.js",
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
"**/*.cjs",
"**/*.mjs",
- "types/global.d.ts"
+ "**/*.ts",
+ "**/*.tsx",
+ ".eslintrc.js",
+ ".next/types/**/*.ts",
+ "next-env.d.ts",
+ "next-env.d.ts",
+ "src",
+ "types/global.d.ts",
+ ".next-check/types/**/*.ts"
]
}
diff --git a/worker/package.json b/worker/package.json
index 883869ee2b..0f9f906eed 100644
--- a/worker/package.json
+++ b/worker/package.json
@@ -14,6 +14,8 @@
"coverage": "vitest run --coverage",
"start": "dotenv -e ../.env -- node dist/index.js",
"build": "tsc",
+ "build:check": "tsc",
+ "typecheck": "dotenv -e ../.env -- tsgo --noEmit --skipLibCheck --incremental --tsBuildInfoFile .tsbuildinfo",
"dev": "dotenv -e ../.env -- tsx watch --clear-screen=false --include '../packages/shared/dist/*' src/index.ts",
"lint": "eslint . --cache --cache-location dist/.eslintcache --max-warnings 0",
"lint:fix": "eslint . --cache --cache-location dist/.eslintcache --fix",
@@ -72,6 +74,7 @@
"@types/pg": "^8.11.10",
"@types/uuid": "^9.0.8",
"@typescript-eslint/parser": "^8.50.1",
+ "@typescript/native-preview": "7.0.0-dev.20260122.3",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-config-standard": "^17.1.0",