-
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
Simultaneous use of export equals and export default in a module #10854
Comments
No it isn't really practical at all, because it isn't "magic" that produces the default export. It is added as a property on the export of the module. What is provided above is trying to export something as I think what you might want to consider the solution to #5285 ( |
There could be a problem. I'm currently doing the magic on the module itself and not relying on any module loader doing the magic for me. There could possibly be people that are not using FYI. This is the magic I do: declare var module: any;
module.exports = myModule;
module.exports.default = myModule; |
declare module 'my-module' {
const test: () => string & { default: () => string };
export = test;
} |
Very neat trick! |
I have some NPM modules written that uses the old default export syntax:
To promote ES import syntax but still keep the old one, I wanted to add both the new and old default export syntax:
Though it complains that it cannot use an export assignment with other export statements.
I think it is reasonable to support both syntax simultaneously in a module. Because choosing between both syntax. I would choose
export =
beforeexport default
, simply because of no API breakage.The text was updated successfully, but these errors were encountered: