Skip to content

Conversation

@swapnil-nagar
Copy link
Contributor

@swapnil-nagar swapnil-nagar commented Feb 6, 2026

PR: Fix missing FormData and Headers type definitions

Problem
Customers using this library were encountering TypeScript compilation errors when importing @azure/functions:

types/http.d.ts:23:7 - error TS2304: Cannot find name 'FormData'.
types/http.d.ts:34:31 - error TS2304: Cannot find name 'Headers'.
types/http.d.ts:120:23 - error TS2304: Cannot find name 'Headers'.
types/http.d.ts:162:38 - error TS2304: Cannot find name 'FormData'.
types/http.d.ts:279:23 - error TS2304: Cannot find name 'Headers'.
types/http.d.ts:316:38 - error TS2304: Cannot find name 'FormData'.

The FormData and Headers types are Web API types used in the HTTP type definitions but were not properly imported. These types are part of Node.js's native fetch API (available since Node.js 18) but TypeScript requires explicit type definitions.

Solution

  1. Added undici-types as an explicit dependency 28kb of library dependency.

Why undici-types?

  • It's the official types package for Node.js's native fetch API (based on undici)
  • It's a types-only package (~28 KB compressed, ~114 KB unpacked) with zero runtime footprint
  • Previously existed only as a transitive dependency of @types/node which caused resolution issues in some customer configurations (pnpm, yarn PnP, strict moduleResolution)
  • Adding it as an explicit dependency ensures customers can resolve the types regardless of their package manager or TypeScript configuration

@swapnil-nagar swapnil-nagar requested a review from a team as a code owner February 6, 2026 05:21
@swapnil-nagar
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

1 participant