Open stefnotch opened 1 year ago
If desired, I'd be happy to make a PR with either Typescript or JSDoc.
You can find the types here
You can add it to your project like this:
npm i --save-dev @types/earcut
@surdu Yes, the public API types are available. I'm specifically asking about internal types though.
After all, I did port earcut to C# once, and it took a fair chunk of time to figure out the internal types.
@mourner If someone wants to take on this task, do you have any preferences? JSDoc, and keeping the tooling the same?
Or Typescript, and changing the build tooling? I think ideally it'd remain very straightforward, and would support https://github.com/mapbox/earcut/issues/126 ?
I used the excellent earcut library, and it was rock solid.
However, once I started looking into porting it to other languages (e.g. C#), I quickly ran into the issue of "wait, what type does this have"?
For example, what type does
list
have? https://github.com/mapbox/earcut/blob/afb5797dbf9272661ca4d49ee2e08bd0cd96e1ed/src/earcut.js#L272C30-L272C30 (Spoiler: It's aNode
. Not aNode[]
)To make porting this library easier, and maybe also to make contributing to this library slightly easier, it would be lovely if we had type annotations.