library-pals / isbn

🔍 An npm module to find books by ISBN (Google Books, Open Library, Libro.fm)
7 stars 1 forks source link

Export types via `exports` field in `package.json` #33

Closed victormihalache closed 2 months ago

victormihalache commented 2 months ago

Fix #31—although increases overall compatibility with some package managers—doesn't fix issue #29. The only thing that seemed to solve it for me was explicitly exporting the types in the exports field by replacing it to be the following:

"exports": {
  ".": {
    "types": "./types/index.d.ts",
    "default": "./src/index.js"
  }
},

This I'm pretty sure won't break anything, but I'm no expert at this.

victormihalache commented 2 months ago

I've based my fix off of seeing how other packages do it. See Zod's package.json

victormihalache commented 2 months ago

Just bumped this dependency and installed a clean node_modules and now everything is typed correctly, without me having to tamper with anything in the node_modules :D