svg-path-bbox icon indicating copy to clipboard operation
svg-path-bbox copied to clipboard

How am I supposed to consume this module in a TypeScript project, with version 1.2.6?

Open dumbmatter opened this issue 1 year ago • 0 comments

First of all thanks for this project, I'm using it over at https://github.com/zengm-games/facesjs

If I upgrade to version 1.2.6, I noticed this error when running tsc:

src/faceToSvgString.ts:1:25 - error TS2307: Cannot find module 'svg-path-bbox' or its corresponding type declarations.

import svgPathBbox from "svg-path-bbox";

I tried playing around with my tsconfig.json settings. Initially I had this, which works with v1.2.5 or lower, but with v1.2.6 it leads to the error above:

    "moduleResolution": "node",

I also tried this:

    "moduleResolution": "NodeNext",
    "module": "NodeNext",

which leads to a different error:

node_modules/svg-path-bbox/dist/types.d.ts:9:1 - error TS2309: An export assignment cannot be used in a module with other exported elements.

export = svgPathBbox;

This does "work", although it's working by ignoring the error, which IMHO is not the ideal solution:

    "moduleResolution": "NodeNext",
    "module": "NodeNext",
    "skipLibCheck": true,

Do you have any recommendation for how I can get this to work, without enabling skipLibCheck?

dumbmatter avatar Mar 31 '24 21:03 dumbmatter