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

Remove content-encoding header #30

Merged
merged 3 commits into from
Feb 12, 2021
Merged

Conversation

binary-person
Copy link
Contributor

this should fix #28

@sindresorhus
Copy link
Owner

You need to update the types too.

@binary-person
Copy link
Contributor Author

binary-person commented Feb 5, 2021

that would be a breaking change as one would need to export the UncompressedIncomingMessage type as well for the user and index.test-d.ts, so code that used to be

const decompressResponse = require('decompress-response');

would need to be rewritten as

const decompressResponse = require('decompress-response').decompressResponse;

is it alright for that to happen?

@sindresorhus
Copy link
Owner

You can still use a module.exports. You just put the type in a namespace: https://github.com/sindresorhus/typescript-definition-style-guide#documentation

@binary-person
Copy link
Contributor Author

alright, thanks! I'm still pretty new to typescript, and wasn't familiar with the idea of namespaces. can you check the commit out?

@sindresorhus
Copy link
Owner

Would be better to use the Omit type.

@binary-person
Copy link
Contributor Author

I've tried before with Omit but since node's http.d.ts's IncomingHttpHeaders extends NodeJS.Dict<string | string[]>, the resulting type when used with Omit is [x: string]: string | string[]; [x: number]: string | string[];

@sindresorhus
Copy link
Owner

sindresorhus commented Feb 9, 2021

Does it work better with https://github.com/sindresorhus/type-fest/blob/main/source/except.d.ts (stricter version of Omit) (just copy-paste it in)? If not, what you have is fine.

@binary-person
Copy link
Contributor Author

no, it doesn't work. it yields the same problem with Omit, with the resulting type being [x: string]: string | string[]; [x: number]: string | string[];

@sindresorhus sindresorhus changed the title remove content-encoding header to fix err_content_decoding Remove content-encoding header Feb 12, 2021
@sindresorhus sindresorhus merged commit 9355974 into sindresorhus:main Feb 12, 2021
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.

content-encoding header should be removed
2 participants