luizbarboza / polyclip-ts

MIT License
28 stars 10 forks source link

avoid error when esModuleInterop enabled #16

Closed cmurphy23 closed 1 month ago

cmurphy23 commented 1 month ago

Hello, there are some errors in turfjs that I believe can solved by using your library, there are several open issues about it, and it has been mentioned here in #7.

I have been able to get turfjs to build with this library, I am in the process of updating the usages of the polygon-clipping project to use this project instead. When I'm finished with that I'll open up a PR there and link it here. It won't be able to be merged until this has been merged and released.

The problem this change solves is it allows typescript to run with esModuleInterop set to true. Prior to these changes, the interoperability check would fail like this:


> tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts

../../node_modules/.pnpm/polyclip-ts@0.16.5/node_modules/polyclip-ts/types/vector.d.ts:3:8 - error TS2709: Cannot use namespace 'BigNumber' as a type```

I'm not a typescript expert, so I don't completely understand the issue, but it seems as though `BigNumber` is already being used as a namespace, and this change just gives it a different name to avoid the conflict.
cmurphy23 commented 1 month ago

Made PR for turf as well: https://github.com/Turfjs/turf/pull/2729