Commit 5cc2de7
fix: pin @types/node to ^20 and update CI matrix to Node 20 (#55)
**Requirements**
- [x] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [x] I have validated my changes against all supported platform
versions
No new test coverage needed — these are dev dependency and CI config
changes only. Build, tests, and lint all pass locally.
**Related issues**
Fixes the Build and Test CI failure on `main` introduced by commit
ae39134 (`ci: Add dependency-scan GitHub Actions workflow (#54)`).
**Describe the solution you've provided**
The `Build and Test` workflow on `main` is failing because `npm install`
resolves `@types/node@25.x` (pulled in transitively by
`jest`/`ts-jest`), which requires TypeScript 5.2+ for
`Disposable`/`AsyncDisposable` support. This project uses TypeScript
`^4.7.4` (resolves to 4.9.5), so the build fails with dozens of type
errors from `@types/node` `.d.ts` files.
This PR:
1. **Pins `@types/node` to `^20`** in `devDependencies`, which is the
latest major version compatible with TypeScript 4.x.
2. **Updates the CI matrix** from Node 18 to Node 20, since Node 18
reached end-of-life on April 30, 2025.
3. **Updates the minimum Node version to 20** in `package.json`
(`engines` field) and `CONTRIBUTING.md` to stay consistent with the CI
matrix and reflect the EOL status of Node 18.
**Describe alternatives you've considered**
- **Upgrade TypeScript to 5.2+**: More forward-looking, but a larger
change with potential downstream effects.
- **Add `skipLibCheck: true` to `tsconfig.json`**: Quick workaround but
masks legitimate type errors in `.d.ts` files.
**Additional context**
> **For reviewer consideration:**
> - The `@types/node` pin uses `^20.19.35` (the latest 20.x at time of
install). Since `package-lock.json` is gitignored, CI will always
resolve the latest within `^20`. The entire 20.x line is compatible with
TS 4.x, so this is safe.
> - `@types/node@20` does not need to exactly match the Node runtime
version — the CI matrix uses `node: latest` and `node: 20`, both of
which are compatible.
> - Node 18 was also exhibiting a separate CI-only type mismatch from
`@openfeature/server-sdk` (older versions resolved non-deterministically
due to absence of a lockfile). Replacing Node 18 with Node 20 in the
matrix sidesteps this, but committing a lockfile would provide more
deterministic builds long-term.
> - A future follow-up to upgrade TypeScript to 5.x would allow
unpinning `@types/node`.
**1 parent ae39134 commit 5cc2de7
3 files changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments