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.
Description
I recently watched your video on "Fix the Fetch Type" and noticed that you implemented the MIME types for the "Content-Type" and "Accept" headers as a union of MIME types. While this approach is effective, you mentioned during the creation of the "TypedHeaders" type that you appreciate having auto-completion for some headers while allowing custom ones to be present as well.
Therefore, I wanted to bring to your attention that a similar approach can be applied to strings as well.
Please feel free to close this PR if you are already aware of this solution.
Explanation
Firstly, I would like to clarify that this is not my original work but was discussed (and solved) in a TypeScript issue back in 2019: microsoft/TypeScript#29729 (comment).
The linked issue-comment also provides an explanation of why/how this works: