Skip to content

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

Closed
@rzhw

Description

@rzhw

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions