-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Unexpected error when importing export =
with function declaration
#36026
Comments
This is the intended behavior because |
Ah, thanks for clarifying that. Given this is a valid CommonJS module definition, I'm wondering how we can import this into our TS project.
Is this case, would you recommend using one of the workarounds I mentioned above, or is there something else we should consider? Types for |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Why doesn't the error occur when namespace is declared? Even in that case, I think the same runtime error occur when the function is called. |
Some people used downlevelers that made this incidentally work and took a hard dependency on that fact, so the namespace declaration is allowed as a workaround |
TypeScript Version: 3.7.3
Search Terms: import export equals = declaration types typings module function declaration expression
Code
(Note: I have intentionally disabled
allowSyntheticDefaultImports
+esModuleInterop
.)Potential/known workarounds
If we use a function expression instead, the problem goes away:
The problem also goes away if we add a
namespace
:The text was updated successfully, but these errors were encountered: