You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use this package with @rollup/plugin-typescript to resolve and edit paths in emitted .d.ts files and the hacky way i finally made it work is like this:
This also means that the types do not correlate (hence the jsdoc comment in my config) so you need to cast it to have nice dx.
I believe this happens because of the way esModuleInterop assigns "default" to the "exports" object though i am not sure.
Side note: For me this package did not work by just editing my tsconfig.json (as suggested in this project's readme), though i believe that it should have (i see no reason the rollup plugin cant use it), maybe that is related to this, as typescript cannot resolve this import. (Maybe the blocker to #134?)
A fix to allow for easier programmatic usage is to include the transformer (and other things, why not) as a named export along the default export, this way the type would match and people could use it this way.
A overall fix would be to figure out a better way to transpile this package to both esm and cjs (rollup?) and therefore not having to rely on esModuleInterop.
I could attempt a PR if any of these options are desirable 👍
The text was updated successfully, but these errors were encountered:
A fix to allow for easier programmatic usage is to include the transformer (and other things, why not) as a named export along the default export, this way the type would match and people could use it this way.
I could attempt a PR if any of these options are desirable 👍
I was trying to use this package with
@rollup/plugin-typescript
to resolve and edit paths in emitted .d.ts files and the hacky way i finally made it work is like this:The true default import looks like this , when it should be the transformer function.
This also means that the types do not correlate (hence the jsdoc comment in my config) so you need to cast it to have nice dx.
I believe this happens because of the way
esModuleInterop
assigns "default" to the "exports" object though i am not sure.Side note: For me this package did not work by just editing my tsconfig.json (as suggested in this project's readme), though i believe that it should have (i see no reason the rollup plugin cant use it), maybe that is related to this, as typescript cannot resolve this import. (Maybe the blocker to #134?)
A fix to allow for easier programmatic usage is to include the transformer (and other things, why not) as a named export along the default export, this way the type would match and people could use it this way.
A overall fix would be to figure out a better way to transpile this package to both esm and cjs (rollup?) and therefore not having to rely on esModuleInterop.
I could attempt a PR if any of these options are desirable 👍
The text was updated successfully, but these errors were encountered: