diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc48a9e..1a0a765 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,7 @@ jobs: run_install: true - run: pnpm run format - run: pnpm run lint + - run: pnpm run typecheck - run: pnpm run test ci-build: diff --git a/benchmarks/fetch/tsconfig.json b/benchmarks/fetch/tsconfig.json new file mode 100644 index 0000000..37e1c9c --- /dev/null +++ b/benchmarks/fetch/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es2022", + "module": "ESNext", + "declaration": true, + "moduleResolution": "Bundler", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "types": ["node"], + "noEmit": true + }, + "include": ["src/**/*", "scripts/**/*"] +} diff --git a/package.json b/package.json index 1c4f269..40fd9dc 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "postbuild": "publint", "prerelease": "pnpm run build && pnpm run test --run", "release": "np --no-publish", + "typecheck": "tsc --noEmit", "lint": "eslint src test", "lint:fix": "eslint src test --fix", "format": "prettier --check \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\"", diff --git a/src/early-hints.ts b/src/early-hints.ts index ecbf026..9f416f5 100644 --- a/src/early-hints.ts +++ b/src/early-hints.ts @@ -27,7 +27,7 @@ export const earlyHints = ( } const env = c.env || {} - const bindings = (env.server ? env.server : env) as HttpBindings + const bindings = ('server' in env ? env.server : env) as HttpBindings const outgoing = bindings?.outgoing // Capability check: outgoing.writeEarlyHints exists and is a function.