xaviergonz / js-angusj-clipper

Polygon and line clipping and offsetting library (Javascript) - a port of Angus Johnson's clipper
MIT License
163 stars 19 forks source link

clipToPaths and clipToPolyTree have incorret undefined union return value? #28

Closed cmidgley closed 1 year ago

cmidgley commented 1 year ago

In ClipperLibWrapper I see that clipToPaths and clipToPolyTree both have return values that are the native type, plus a union for undefined:

clipToPaths(params: ClipParams): Paths | undefined { ... }
clipToPolyTree(params: ClipParams): PolyTree | undefined { ... }

However, in looking at the implementation, I see that the lower level functions (in functions.ts) do not return undefined, and appear to throw exceptions on errors. I did not look deeper to verify if this was a perhaps type error on those functions (in functions) but seeing as the other methods in ClipperLibWrapper do not return undefined I'm wondering if the undefined can be removed from ClipperLibWrapper?

clipToPaths(params: ClipParams): Paths { ... }
clipToPolyTree(params: ClipParams): PolyTree { ... }

Edit: I noticed there are other methods as well that define a union return type with undefined, but not all of them.

xaviergonz commented 1 year ago

Thanks! you were right. fixed in v1.3.1