diff --git a/dependencies.md b/dependencies.md index c044d84f3..79505d778 100644 --- a/dependencies.md +++ b/dependencies.md @@ -184,3 +184,11 @@ Generally, dependencies are added by simply adding them to the dependencies list - Binary compilation: No. - Can be deferred: The require happens only when `server/serverHelpers/multipartParser.ts` is imported, which is loaded by `registerContentHandlers` at operations-server boot. Realistically always loaded. - Eventual removal: Could be replaced by writing our own streaming multipart parser (a few hundred lines plus tests for edge cases) if maintenance ever lapses, or by Node.js's `request.formData()` once that API supports streaming file parts without buffering (currently it doesn't on the standard Node http server interface used by Fastify). + +## typescript@7 (not a dependency — invoked via npx, pinned separately from the `typescript` devDependency) + +- Need for usage: TypeScript 7 merges the native (Go-ported) compiler preview directly into the `typescript` package's `tsc` binary — there is no separate `tsgo` binary or `@typescript/native-preview` package at 7.0.2+. Wired as an opt-in `npm run typecheck:fast` script — a faster local/CI type-check loop alongside the existing `tsc`-based `build`, not a replacement for either. +- Not a `package.json` dependency: `typecheck:fast` runs `npx -y -p typescript@ tsc ...` rather than adding this as a `devDependency`. This is deliberate, and for the same reason as before: an earlier version of this change had the equivalent tool (`@typescript/native-preview`) as a plain `devDependency`, which meant `npm ci` fetched it for every CI job (unit, integration, smoke, stress), not just the opt-in checker. Since the package name here is `typescript` — the same name as our existing 5.x devDependency — it also could not be added as a second `package.json` entry at a different version without colliding; `npx -p typescript@7.0.2` sidesteps this too, resolving and running the pinned 7.x tarball from npm's npx cache without touching the project's installed 5.x `typescript`. Running it via `npx` on-demand confines a pruned-tarball failure to `typecheck:fast` alone, matching its actually-opt-in nature. Trade-off: no `package-lock.json` integrity-hash pinning for this tool (the exact version is still pinned in the npx invocation itself, just not hash-verified against a lockfile entry). +- Security: Microsoft-maintained TypeScript compiler, same publisher/package as the 5.x devDependency. +- Overlap: Complements, does not replace, the `typescript` devDependency — TypeScript 7.0 ships no compiler API yet (planned for 7.1), so `@typescript-eslint/parser` still needs `typescript` 5.x. The 5.x and 7.x versions never coexist in `node_modules` at once: 5.x is the installed devDependency, 7.x is fetched on-demand by `npx` purely for `typecheck:fast`. +- Eventual removal: Once TypeScript 7 stabilizes as the primary `typescript` devDependency (post-7.1's compiler API), this becomes redundant and `typecheck:fast` can be dropped. diff --git a/package.json b/package.json index 201e7562f..35c3d1736 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,8 @@ "scripts": { "build": "tsc --project tsconfig.build.json", "build:watch": "npm run build -- --watch --incremental", + "typecheck": "tsc --project tsconfig.json", + "typecheck:fast": "npx -y -p typescript@7.0.2 tsc --noEmit --project tsconfig.json", "package": "./build-tools/build.sh", "lint": "oxlint --format stylish --deny-warnings .", "lint:required": "oxlint --format stylish --quiet .", diff --git a/tsconfig.json b/tsconfig.json index a41dc0e8c..06d1f234b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -37,6 +37,10 @@ // Allow .ts extensions in imports (will be transpiled to .js by esbuild) "allowImportingTsExtensions": true, + // Codebase is not strict-clean yet; pin explicitly so a compiler upgrade + // that flips this default (e.g. TypeScript 7) doesn't silently change results + "strict": false, + // Enforce erasable syntax only so we can use Node.js type-stripping "erasableSyntaxOnly": true, // Required: third-party type declarations (alasql, mathjs, msgpackr) have incompatible type errors