google / postcss-rename

Replace class names based on a customizable renaming scheme.
Apache License 2.0
125 stars 18 forks source link

Switch export style from "export default" to "export =" #27

Closed rzhw closed 4 years ago

rzhw commented 4 years ago

When a JS node module consumer uses a TS node module that exports using export default, the JS author must write const moduleName = require('module-name').default.

This is unnatural for node modules, so we should switch the default export to export =, as per https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.

Note this means we can only have one export per file, i.e. we can't export the Options interface simultaneously.

I think this export is unnecessary, given the interface is only for type hinting to users of the plugin. This would break in the case a user wants to wrap the plugin with TS and forward the Options type explicitly, so we may want to consider making the Options interface available in a standalone options.ts file.

Until that's required, I think we can keep Options unexported.