FormDataLike
iterator type is incorrect
#19
Labels
bug
Something isn't working
TypeScript
TypeScript-related changes, like types or build its build infrastructure
The iterator type for FormDataLike is incorrect / too restrictive (
form-data-encoder/src/FormDataLike.ts
Line 43 in 8c8085d
Generator
which makes methodsthrow
andreturn
required. But based on the spec, those two are optional for iterators (see here in MDN docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#throwexception) which are linked to in the source ofFormDataLike
itself.I believe the types in undici are more accurate (https://github.com/nodejs/undici/blob/8050ec0224a51d44f776364820e6a16112fb4781/types/formdata.d.ts#L105 and https://github.com/nodejs/undici/blob/8050ec0224a51d44f776364820e6a16112fb4781/types/fetch.d.ts#L41-L47).
This is actually how I found this issue. I was trying to use the FormData object from Undici with the FormDataEncoder from this library.
The text was updated successfully, but these errors were encountered: