Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript or JSDoc #164

Open
stefnotch opened this issue Nov 4, 2023 · 4 comments
Open

Typescript or JSDoc #164

stefnotch opened this issue Nov 4, 2023 · 4 comments

Comments

@stefnotch
Copy link

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 a Node. Not a Node[])

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.

@stefnotch
Copy link
Author

If desired, I'd be happy to make a PR with either Typescript or JSDoc.

@surdu
Copy link

surdu commented Jan 24, 2024

You can find the types here

You can add it to your project like this:

npm i --save-dev @types/earcut

@stefnotch
Copy link
Author

@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.

@stefnotch
Copy link
Author

@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 #126 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants