-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
allowSyntheticDefaultImports
works differently for dynamic ESM imports of CommonJS modules
#22456
Comments
Note that For your sanity, avoid using |
Hmmm, my bad, you're right. Just found this in Webpack 4 changelog:
|
Just to be clear: dynamic ESM import will provide |
Yes; CJS will always map to |
TypeScript Version: 2.7.2
Search Terms: "allowSyntheticDefaultImports dynamic import"
Code
mkdirp
declaration is exported asexport = mkdirp
and notexport default mkdirp
.Expected behavior:
Imported types are the same.
Actual behavior:
It works as expected in the first case – TS checked that there is no
default
export and returned exported function directly.It doesn't work as expected in the second case – TS provided types for the module like it has
default
export, so it wont allow to callmkdirp_()
directly butmkdirp_.default()
.I'm using Babel for transpilation, so the question is only about types provided by TypeScript,
noEmit
istrue
.Related Issues:
#17444
The text was updated successfully, but these errors were encountered: