Hexagon / base64

Base64 and base64url to string or arraybuffer, and back. Works in Node, Deno or browser.
http://base64.56k.guru/
MIT License
9 stars 2 forks source link

types not exported correctly #184

Open cloudkite opened 2 months ago

cloudkite commented 2 months ago

Types are not being picked up in my project, heres a minimal reproduction:

https://stackblitz.com/edit/vitejs-vite-ayep6m?file=src%2Fmain.ts

CleanShot 2024-06-22 at 16 27 33@2x

I think this has todo with the following settings in tsconfig

"moduleResolution": "Bundler",
"module": "ESNext",

I could resolve this by patching @hexagon/base64 package.json to the following:

   "exports": {
     ".": {
-      "import": "./src/base64.js",
+      "import": {"default":"./src/base64.js", "types":"./types/base64.d.ts"},
       "require": "./dist/base64.cjs",
       "browser": "./dist/base64.min.js"
     }
cloudkite commented 2 months ago

Also this might be helpful https://www.npmjs.com/package/@arethetypeswrong/cli

https://arethetypeswrong.github.io/?p=%40hexagon%2Fbase64%401.1.28.

evert commented 2 months ago

Same here! Only started showing up once i switched to esm

Hexagon commented 4 weeks ago

I'm working on a new major release simplifying the build process, check if 2.0.0-dev.1 (npm i @hexagon/base64@dev) works better

chrisspiegl commented 1 week ago

I installed the 2.0.0-dev.1 and the types show up and it looks fine.

Xnapper-2024-09-05-18 56 06 Xnapper-2024-09-05-18 56 19