siefkenj / unified-latex

Utilities for parsing and manipulating LaTeX ASTs with the Unified.js framework
MIT License
85 stars 20 forks source link

fix: proper type export #29

Closed tefkah closed 1 year ago

tefkah commented 1 year ago

Typescript complains of "Cannot find a declaration module or file", mostly for @unified-latex/unified-latex-types and @unified-latex/unified-latex-builder. It does not always do this, which is weird, but if I put this in the outputted package.json it always works properly.

       "exports": {
           ".": {
               "import": "./index.js",
               "require": "./index.cjs",
+++            "types": "./index.d.ts"
           },

This PR adds this field by default. I'm not sure if this will break some packages or not, you might have a better idea of that!

siefkenj commented 1 year ago

Very interesting...Does this happen with the packages installed from npm or with the local packages or both? The whole package management system is a confusing beast to me, but if this works, it doesn't look like it should cause any harm...

Are you using the latest version of Typescript?

tefkah commented 1 year ago

It happens when installed from npm, the local packages seem to work fine!

tefkah commented 1 year ago

And yes, on the latest version

siefkenj commented 1 year ago

Thanks for the patch! I've pushed the update. Hopefully types are working now!