Skip to content
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

When importing this lib from a pure ESModule the "double default" issue happens #69

Open
sergioflores-j opened this issue Aug 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sergioflores-j
Copy link
Owner

It would be nice if the lib could improve the ESM <> CJS interoperability.

Current behavior

The lib only exports CJS with a __esModule flag.
See Are the Types Wrong

import wrapException from '@ts-to-go/wrap-exception'

wrapException(myFn) // this is not callable and fails TS transpilation
wrapException.default(myFn) // this is callable

More in depth information:
https://www.typescriptlang.org/docs/handbook/modules/appendices/esm-cjs-interop.html#no-__esmodule-detection-the-double-default-problem
evanw/esbuild#1719

Expected behavior

Lib works both in ESModules and CJS.

import wrapException from '@ts-to-go/wrap-exception'

wrapException(myFn) // this is callable
@sergioflores-j sergioflores-j added the bug Something isn't working label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant