-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Default export behavior when module "default" key is undefined #13017
Comments
The ES6 module semantics are very clear on these points:
It'd be incorrect for us to emit anything other than If the top-level export of the It's possible but unlikely that the |
Thank you very much for this comprehensive answer, I'll check this out and report back. In the time being, I'm closing this. |
Leaving this here if somebody is gonna stumble on this thread again when having troubles with setting up his/her build pipeline relaying on rollup. From my point of view if you want to provide a structure that is consumable for your TS typings, you should simply use Going further - if you do not enforcing CJS consumers to use |
TypeScript Version: 2.1.4 / tried with current nightly yesterday
Linked issues :
rollup/rollup#1156
infernojs/inferno#596
Code
Inferno exports something like:
In typescript, it is
export default class Component{}
.When imported, you'll expect this to work:
But those will both be undefined because the typescript compiler exports something like:
I also tried to import as:
Which does bring back the correct values, except their signature is now wrong and you can not use them as intended (for example
class extend Component
).Reproduction
Here is a reproduction repository:
https://github.com/soyuka/repro-default-export
Clone and run
bash init.sh
.Note that:
To me it's probably that typescript always expect a default key, which is why I made a proposal to add the following to rollup:
Would you be able to give me some details about the typescript expected behavior? Is this a rollup issue or a typescript one?
Thanks!
The text was updated successfully, but these errors were encountered: