vscode-typescript-exportallmodules icon indicating copy to clipboard operation
vscode-typescript-exportallmodules copied to clipboard

Add handling of default exports

Open gforge opened this issue 5 years ago • 2 comments
trafficstars

It would be nice if files with /^export default/ exported that member as export { default as ${fileWithoutExtension} } from './${fileWithoutExtension}'.

gforge avatar Dec 27 '19 19:12 gforge

Should this be an option? Or should it be always like this?

Will your files that contain a default contain other exports?

estruyf avatar Jun 17 '21 15:06 estruyf

As it is a common export style that has been around for a long time I suggest that it should be on by default. I have started to drop the default export as it adds little value and named exports have mostly benefits as I see it.

I think that one can expect that in TypeScript settings there will most likely be a mix of types being exported together with some core function, e.g. NavBar & NavBarProps.

gforge avatar Jun 17 '21 20:06 gforge

Now that we have support for named exports in the extension, I've also included support for handling default exports.

Defaults will be exported with the function's name, class name, interface's name, or the filename will be used if not provided.

estruyf avatar Jul 22 '24 12:07 estruyf