GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add autocompletable header types by KhafraDev · Pull Request #3462 · nodejs/undici

Conversation

@KhafraDev

@KhafraDev KhafraDev commented Aug 15, 2024

Copy link
Copy Markdown
Member

the header keys were taken from MDN and the values for the content-type header were taken from hono

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@KhafraDev
add autocompletable header types
b178dd1
@KhafraDev
KhafraDev requested review from Ethan-Arrowood and Uzlopak August 15, 2024 02:55
@KhafraDev

KhafraDev commented Aug 15, 2024

Copy link
Copy Markdown
Member Author

The types only work for the object param of the constructor. It would be possible to add support for the other methods, but would require a generic which would interfere with the DOM types.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

KhafraDev
KhafraDev commented Aug 15, 2024
View reviewed changes
Comment thread types/fetch.d.ts
}

export type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
export type HeadersInit = [string, string][] | HeaderRecord | Headers

@KhafraDev KhafraDev Aug 15, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReadonlyArray is just not correct. If we were to follow the logic in the PR that added it, the type should be any.

Any array pair that doesn't contain exactly 2 strings throws an error too, so string[][] is not strict enough.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Ethan-Arrowood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
mcollina
mcollina approved these changes Aug 15, 2024
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Uzlopak
Uzlopak reviewed Aug 15, 2024
View reviewed changes
Comment thread types/header.d.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Uzlopak
Uzlopak reviewed Aug 15, 2024
View reviewed changes
Comment thread types/header.d.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Uzlopak
Uzlopak reviewed Aug 15, 2024
View reviewed changes
Comment thread types/header.d.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Uzlopak
Uzlopak reviewed Aug 15, 2024
View reviewed changes
Comment thread types/header.d.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Uzlopak
Uzlopak previously requested changes Aug 15, 2024
View reviewed changes

@Uzlopak Uzlopak left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss this a little bit before merging.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Ethan-Arrowood
Ethan-Arrowood approved these changes Aug 15, 2024
View reviewed changes

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@KhafraDev
KhafraDev dismissed Uzlopak’s stale review August 16, 2024 18:21

outdated

@KhafraDev
KhafraDev merged commit 14ba3e8 into nodejs:main Aug 16, 2024
@KhafraDev
KhafraDev deleted the headers-types branch August 16, 2024 18:26
@Uzlopak Uzlopak mentioned this pull request Aug 16, 2024
types: add Autocomplete utility type #3479
Merged
@github-actions github-actions Bot mentioned this pull request Dec 3, 2024
[Release] v7.1.0 #3922
Merged
This was referenced Dec 16, 2024
[Release] v7.1.1 #3952
Closed
[Release] v7.2.0 #3962
Merged
@github-actions github-actions Bot mentioned this pull request Mar 12, 2025
[Release] v6.21.2 #4092
Closed
@github-actions github-actions Bot mentioned this pull request May 12, 2025
[Release] v6.21.3 #4211
Closed
@simhnna simhnna mentioned this pull request Oct 23, 2025
HeadersInit types no longer allow Record<string, string[]> #4641
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@Ethan-Arrowood Ethan-Arrowood Ethan-Arrowood approved these changes
@Uzlopak Uzlopak Uzlopak left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@KhafraDev @mcollina @Uzlopak @Ethan-Arrowood
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.