Fix Node.js driver CI build broken by @types/node drift#2452
Conversation
The Node.js driver CI (npm install -> npm run build -> tsc) failed with parser errors in node_modules/@types/node/ffi.d.ts (TS1139/TS1005/TS1109/ TS1128). package-lock.json is gitignored, so CI resolves dependencies purely from package.json. @types/node was only pulled transitively via a wildcard range (@types/pg and jest depend on @types/node@*), so a fresh install grabbed the latest (26.x). That version uses `const` type parameters (a TypeScript 5.0 feature) in ffi.d.ts, which typescript@4.9 cannot parse. skipLibCheck does not suppress these parser-level errors. The runtime Node version is unrelated: @types/node is resolved from the npm dependency graph, not the Node.js runtime. Fix: - Add a bounded direct devDependency "@types/node": "^20.19.0" so a fresh install constrains the typings to the Node 20 LTS line, which is compatible with typescript@4.9 and keeps the toolchain consistent (eslint 7 / typescript-eslint 4 / TS 4.9 / Node 20 typings). - Pin CI to Node 20 (setup-node@v4, node-version: 20) for reproducibility and to match the pinned typings; replaces the deprecated setup-node@v3 and floating node-version: latest. Verified: a clean, no-lockfile install (matching CI) now resolves @types/node@20.19.43 and tsc builds successfully. Co-authored-by: Copilot <copilot@github.com> modified: .github/workflows/nodejs-driver.yaml modified: drivers/nodejs/package.json
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the Node.js driver’s CI TypeScript build by preventing @types/node from drifting to versions that are incompatible with the repository’s TypeScript toolchain, and by making the CI Node runtime selection more consistent.
Changes:
- Add a direct devDependency on
@types/nodeconstrained to the Node 20 line to avoid transitive wildcard resolution pulling newer major typings. - Update the CI workflow to use
actions/setup-node@v4and run on Node 20 instead of a floatinglatest.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
drivers/nodejs/package.json |
Adds a bounded direct @types/node devDependency to prevent transitive typings drift from breaking tsc. |
.github/workflows/nodejs-driver.yaml |
Pins CI to Node 20 and updates to setup-node@v4 for more stable, modern CI setup behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gregfelice
left a comment
There was a problem hiding this comment.
LGTM — approving.
Correct root-cause fix: unpinned @types/node was resolving transitively to 26.x, whose ffi.d.ts uses TS 5.0 const type parameters that the pinned typescript@4.9 can't parse. Adding the bounded "@types/node": "^20.19.0" devDependency constrains typings to the Node 20 LTS line (compatible with the TS 4.9 / eslint 7 / typescript-eslint 4 toolchain), and pinning CI to Node 20 + setup-node@v4 keeps runtime and typings aligned.
Verified locally (no lockfile, matching CI): a clean install resolves @types/node@20.19.43 (no ffi.d.ts) and tsc builds cleanly under TS 4.9. All five workflows — including Nodejs Driver Tests — are green on the PR head.
Low risk: touches only the Node.js driver devDependency and its CI workflow; no product code or other drivers affected.
The Node.js driver CI (npm install -> npm run build -> tsc) failed with parser errors in node_modules/@types/node/ffi.d.ts (TS1139/TS1005/TS1109/ TS1128). package-lock.json is gitignored, so CI resolves dependencies purely from package.json. @types/node was only pulled transitively via a wildcard range (@types/pg and jest depend on @types/node@*), so a fresh install grabbed the latest (26.x). That version uses
consttype parameters (a TypeScript 5.0 feature) in ffi.d.ts, which typescript@4.9 cannot parse. skipLibCheck does not suppress these parser-level errors.The runtime Node version is unrelated: @types/node is resolved from the npm dependency graph, not the Node.js runtime.
Fix:
Verified: a clean, no-lockfile install (matching CI) now resolves @types/node@20.19.43 and tsc builds successfully.
Co-authored-by: Copilot copilot@github.com
modified: .github/workflows/nodejs-driver.yaml
modified: drivers/nodejs/package.json