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

Fix the NormalizedOptions.headers TypeScript type #243

Merged
merged 1 commit into from
Apr 15, 2020

Conversation

sholladay
Copy link
Collaborator

@sholladay sholladay commented Mar 8, 2020

Fixes #240

This PR removes a vestigial part of our NormalizedOptions TypeScript interface that is no longer necessary and causes issues for TypeScript users who pass the headers option as a plain object (as opposed to a Headers instance) and then receive it inside of a hook. The definition of headers now comes from RequestInit.

For context, in older versions of Ky, we aggressively normalized the options object passed by the user before running any hooks. However, newer versions of Ky try to avoid such normalizations in favor of constructing a Request instance and passing that around, as it does a lot of the work for us, including normalizing the headers.

@sholladay sholladay changed the title Fix type of headers in NormalizedOptions Fix the NormalizedOptions.headers TypeScript type Apr 15, 2020
@sholladay sholladay merged commit fcb8009 into master Apr 15, 2020
@sholladay sholladay deleted the update-headers-type branch April 15, 2020 18:53
@sindresorhus
Copy link
Owner

Sorry. I missed this. Looks good 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NormalizedOptions interface giving wrong Headers type
2 participants