-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypeScript definition to CommonJS compatible export (#17)
- Loading branch information
1 parent
a12b4c8
commit 03c09de
Showing
4 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
/// <reference types="node"/> | ||
import {IncomingMessage} from 'http'; | ||
|
||
/** | ||
* Decompress a HTTP response if needed. | ||
* | ||
* @param response - The HTTP incoming stream with compressed data. | ||
* @returns The decompressed HTTP response stream. | ||
*/ | ||
export default function decompressResponse(response: IncomingMessage): IncomingMessage; | ||
declare const decompressResponse: { | ||
/** | ||
Decompress a HTTP response if needed. | ||
@param response - The HTTP incoming stream with compressed data. | ||
@returns The decompressed HTTP response stream. | ||
@example | ||
``` | ||
import {http} from 'http'; | ||
import decompressResponse = require('decompress-response'); | ||
http.get('https://sindresorhus.com', response => { | ||
response = decompressResponse(response); | ||
}); | ||
``` | ||
*/ | ||
(response: IncomingMessage): IncomingMessage; | ||
|
||
// TODO: remove this in the next major version, refactor the whole definition to: | ||
// declare function decompressResponse(response: IncomingMessage): IncomingMessage; | ||
// export = decompressResponse; | ||
default: typeof decompressResponse; | ||
}; | ||
|
||
export = decompressResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters