diff --git a/package-lock.json b/package-lock.json index 3125c1d..52ca72a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@commitlint/cli": "^20.5.0", "@commitlint/config-conventional": "^20.5.0", "@eslint/js": "^10.0.1", + "@types/node": "^24.0.0", "@vitest/coverage-istanbul": "^4.1.2", "eslint": "^10.1.0", "eslint-config-prettier": "^10.1.8", @@ -2488,14 +2489,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "25.3.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.5.tgz", - "integrity": "sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA==", + "version": "24.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.0.tgz", + "integrity": "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "undici-types": "~7.18.0" + "undici-types": "~7.16.0" } }, "node_modules/@typescript-eslint/types": { @@ -5783,12 +5783,11 @@ } }, "node_modules/undici-types": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", - "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/unenv": { "version": "2.0.0-rc.24", diff --git a/package.json b/package.json index 88a5f83..be91b30 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@commitlint/cli": "^20.5.0", "@commitlint/config-conventional": "^20.5.0", "@eslint/js": "^10.0.1", + "@types/node": "^24.0.0", "@vitest/coverage-istanbul": "^4.1.2", "eslint": "^10.1.0", "eslint-config-prettier": "^10.1.8", diff --git a/test/unit/typescript-config.test.js b/test/unit/typescript-config.test.js new file mode 100644 index 0000000..e69ffaa --- /dev/null +++ b/test/unit/typescript-config.test.js @@ -0,0 +1,19 @@ +// @vitest-environment node + +import { createRequire } from 'node:module'; + +import { describe, expect, it } from 'vitest'; + +const require = createRequire(import.meta.url); +const tsconfig = require('../../tsconfig.json'); +const packageJson = require('../../package.json'); + +describe('TypeScript config', () => { + it('explicitly includes Node.js types for mixed runtime files', () => { + expect(tsconfig.compilerOptions.types).toContain('node'); + }); + + it('declares Node.js typings as a dev dependency', () => { + expect(packageJson.devDependencies['@types/node']).toBeTruthy(); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 93f2536..d4a01f7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "noEmit": true, "skipLibCheck": true, "strict": true, - "target": "ES2022" + "target": "ES2022", + "types": ["node"] }, "exclude": ["node_modules", "dist", "coverage"], "include": ["src/**/*", "test/**/*", "node_modules/@cloudflare/vitest-pool-workers/types/**/*"]