Skip to content

Add ESM implementation and type declarations#52

Open
mherod wants to merge 1 commit intomasterfrom
esm-and-types
Open

Add ESM implementation and type declarations#52
mherod wants to merge 1 commit intomasterfrom
esm-and-types

Conversation

@mherod
Copy link
Copy Markdown

@mherod mherod commented Oct 2, 2024

Description of the Change

  • Adds ESM implementation, essentially a slight syntax shuffle of the original CommonJS code
  • Adds type declaration
  • Update the README with new examples for the ESM code

Benefits

  • Gives developers the choice of either CJS or ESM without needing their bundler to do all the work
  • Type declaration enables IDE type inference, less coding in the dark

Possible Drawbacks

  • Duplication of the implementation could be mitigated by transpiling from a Typescript source with a bundler setup. Easy ground for Vite to take care of if we wanted to do that.

Verification Process

Applicable Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant