unjs / jiti

Runtime Typescript and ESM support for Node.js
MIT License
1.49k stars 52 forks source link

fix(types): fix type exports #244

Closed remcohaszing closed 1 week ago

remcohaszing commented 1 month ago

πŸ”— Linked issue

https://github.com/twoslashes/twoslash/pull/42#discussion_r1631001129

❓ Type of change

πŸ“š Description

Jiti uses a special build step to compile the default export to export =. The generated type definitions don’t match this. To resolve this, a manual type declaration file was added.

πŸ“ Checklist

pi0 commented 1 month ago

Thanks for the PR. Would you mind to target it to 1.x branch? (I'm working on another refactor that changes whole bundling system of jit 2.x)

remcohaszing commented 1 month ago

If you’re doing a semver major, I suggest another solution: Use a named export.

pi0 commented 1 month ago

Defenitly. Default will be for retro compat but yes i am planning to use ESM + named.

remcohaszing commented 1 month ago

In that case I don’t recommend merging this into the 1.x branch. Feel free to merge or close this as you like. :)

pi0 commented 1 week ago

Thanks for PR again. jiti v2 is almost ready with named { createJiti } export.