Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing type updates in undici.request #2748

Closed
JaoodxD opened this issue Feb 12, 2024 · 3 comments · Fixed by #2879
Closed

Missing type updates in undici.request #2748

JaoodxD opened this issue Feb 12, 2024 · 3 comments · Fixed by #2879
Labels
enhancement New feature or request

Comments

@JaoodxD
Copy link
Contributor

JaoodxD commented Feb 12, 2024

The recent PR #2708 introduced support for passing Headers instances, Map instances, and iterable objects as the headers argument to undici.request.
However, there have been no updates to documentation or types to reflect these changes.
This oversight needs to be addressed.

I'm considering fixing this issue, but I'd appreciate input from more experienced contributors like @mcollina, @metcoder95, @KhafraDev, and @mertcanaltin. Do any of you have suggestions or thoughts on how to approach this?

One approach I'm considering is extending the existing UndiciHeaders type with a definition similar to the following:

type HeadersType = 
  Record<string, string | string[] | undefined> | 
  string[] | 
  null |
  Headers | 
  Map<string, string | string[] | undefined> | 
  Iterable<[string, string | string[] | undefined]>;

However, this may seem a bit verbose. I'm open to alternative suggestions or approaches.

It would also be helpful if someone could provide a checklist or guidelines for updating documentation and types in situations like this.
This could ensure that similar oversights are avoided in the future.

@JaoodxD JaoodxD added the enhancement New feature or request label Feb 12, 2024
@ronag
Copy link
Member

ronag commented Feb 12, 2024

I think Iterable covers Record, Map and Headers

@Uzlopak
Copy link
Contributor

Uzlopak commented Feb 26, 2024

@JaoodxD

Just provide a PR and add tsd typings tests. ;)

@JaoodxD
Copy link
Contributor Author

JaoodxD commented Feb 26, 2024

@JaoodxD

Just provide a PR and add tsd typings tests. ;)

Sure. It's in progress.

@JaoodxD JaoodxD mentioned this issue Feb 28, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants