Skip to content

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

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

Closed
rzhw opened this issue Apr 30, 2020 · 0 comments · Fixed by #28
Closed

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

rzhw opened this issue Apr 30, 2020 · 0 comments · Fixed by #28
Assignees

Comments

@rzhw
Copy link
Contributor

rzhw commented Apr 30, 2020

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.

@rzhw rzhw self-assigned this Apr 30, 2020
@rzhw rzhw closed this as completed in #28 May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant