-
-
Notifications
You must be signed in to change notification settings - Fork 969
Closed
Description
Describe the bug
The Request
class is exported as the default export from source/core/index
.
In source/index
, the types from source/core/index
are exported with an aggregation, like so: export * from 'source/core/index.js'
:
Line 19 in 49c605c
export * from './core/index.js'; |
This re-export don't propagate the default export from
source/core/index.js
: https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/exportHence the
Request
type is lost in the re-export.
It is not in the list of exported type: https://github.com/sindresorhus/got/blob/main/documentation/typescript.md
So, I am not sure if this missing type is by design, or not. Feel free to close if this type is expected to be hidden.
Actual behavior
import got from 'got'
let request: ReturnType<got.stream>
try {
request = got.stream(url)
} catch(error) {
// handle error
}
Expected behavior
import got, {Request} from 'got'
let request: Request
try {
request = got.stream(url)
} catch(error) {
// handle error
}
Checklist
- I have read the documentation.
- I have tried my code with the latest version of Node.js and Got.
Metadata
Metadata
Assignees
Labels
No labels