-
Notifications
You must be signed in to change notification settings - Fork 559
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
add autocompletable header types #3462
Conversation
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. |
@@ -67,7 +67,7 @@ export interface SpecIterable<T> { | |||
[Symbol.iterator](): SpecIterator<T>; | |||
} | |||
|
|||
export type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers | |||
export type HeadersInit = [string, string][] | HeaderRecord | Headers |
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.
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
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.
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
the header keys were taken from MDN and the values for the content-type header were taken from hono