dfpc-coe / node-CoT

Javascript Cursor-On-Target Library
https://dfpc-coe.github.io/node-CoT/index.html
MIT License
13 stars 4 forks source link

type exports not always working #47

Closed mrtnlrsn closed 1 month ago

mrtnlrsn commented 1 month ago

Hi

In my unit test files (not my main files, I do not understand why there is a difference) I get

Could not find a declaration file for module '@tak-ps/node-cot'. '/home/mla/work/argos/node_modules/.pnpm/@tak-ps+node-cot@12.6.0/node_modules/@tak-ps/node-cot/dist/index.js' implicitly has an 'any' type.
There are types at '/home/mla/work/argos/js_src/mdc2_tak_service/node_modules/@tak-ps/node-cot/index.ts', but this result could not be resolved when respecting package.json "exports". The '@tak-ps/node-cot' library may need to update its package.json or typings

Removing the newly added exports property from your package.json fixes it. Alternatively the below version also seems to work. However, I don't fully comprehend this, so I don't know if either is a solution...

    "exports": {
        ".": {
            "import": {
                "default": "./dist/index.js",
                "types": "./index.ts"
            }
        }
    },
ingalls commented 1 month ago

@mrtnlrsn I'll just remove the exports for now, I was fighting a similar typing issue and that seemed to be the new suggsetion for exporting (Ref) https://nodejs.org/api/packages.html#exports but it just seems to do more pain than good.

ingalls commented 1 month ago

Try: v12.7.1 - If that works feel free to close this issue.

mrtnlrsn commented 1 month ago

this works, thanks.