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: import BodyReadable
and Dispatcher
correctly
#1424
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1424 +/- ##
=======================================
Coverage 94.27% 94.27%
=======================================
Files 49 49
Lines 4248 4248
=======================================
Hits 4005 4005
Misses 243 243 Continue to review full report at Codecov.
|
BodyReadable
correctlyBodyReadable
and Dispatcher
correctly
@@ -1,5 +1,5 @@ | |||
import { expectAssignable } from 'tsd' | |||
import BodyReadable from '../../types/readable' | |||
import BodyReadable = require('../../types/readable') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible for us to test both ways? I want to ensure we are not breaking allowSyntheticDefaultImports=true
users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is! There is no impact for configurations with the setting enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if instead BodyReadable
was changed to be a named export? Because import require is a TypeScript-ism that doesn't really have an equivalent in regular JavaScript
@Ethan-Arrowood could you review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Oh sorry I was waiting for another test case - but if it works still no worries |
* fix: import `BodyReadable` correctly * fix: import `Dispatcher` correctly * chore: fix `BodyReadable`'s import
* fix: import `BodyReadable` correctly * fix: import `Dispatcher` correctly * chore: fix `BodyReadable`'s import
* fix: import `BodyReadable` correctly * fix: import `Dispatcher` correctly * chore: fix `BodyReadable`'s import
This PR is a continuation of the changes made in #1059.
BodyReadable
is imported with the assumption thatallowSyntheticDefaultImports
is enabled. This is restrictive to consumers wishing to use undici's type definitions without its enablement.The following imports have been fixed:
BodyReadable
in test/types/readable.test-d.tsBodyReadable
in types/dispatcher.d.tsDispatcher
in types/mock-interceptor.d.ts