Skip to content

fix: add RequestInit duplex type - #1890

Open
puneetdixit200 wants to merge 1 commit into
node-fetch:mainfrom
puneetdixit200:fix/requestinit-duplex-type
Open

fix: add RequestInit duplex type#1890
puneetdixit200 wants to merge 1 commit into
node-fetch:mainfrom
puneetdixit200:fix/requestinit-duplex-type

Conversation

@puneetdixit200

Copy link
Copy Markdown

Purpose

Allow TypeScript users to pass Fetch's duplex: 'half' option in RequestInit.

Changes

  • Added a RequestDuplex type and RequestInit.duplex.
  • Added type coverage for constructing a Request with duplex: 'half'.
  • Changed an existing URL constructor check into an expectType<Request>(...) assertion so the type test is lint-clean.

Additional information

Verified locally:

  • npx tsc --noEmit --skipLibCheck --lib es2020,dom --moduleResolution node --module esnext --target es2020 --esModuleInterop ".\@types\index.test-d.ts"
  • npm run lint
  • git diff --check

Notes from broader local checks:

  • npm run test-types still fails in this checkout on existing FormData/File global type resolution after a fresh dependency install, but the new duplex assertion is no longer among the failures.
  • npm test reached 386 passing and 3 pending, with 5 local network/timing failures under the current Node runtime.

  • I added type test coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript RequestInit interface missing 'duplex'

1 participant