svgdotjs / svgdom

Straightforward DOM implementation to make SVG.js run headless on Node.js
MIT License
269 stars 53 forks source link

Please review my TypeScript types #110

Closed altano closed 1 year ago

altano commented 1 year ago

I'm adding TypeScript types for this library to DefinitelyTyped. Once submitted, people will be able to npm install @types/svgdom to get TypeScript types for this library.

Would anyone be willing to review the types I've created over at https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66501/files?

Fuzzyma commented 1 year ago

What are the advantages of having the types over at definitely typed? Why not create a PR for this repo instead?

altano commented 1 year ago

DefinitelyTyped is where the community can fill the gap when maintainers don’t want to do that investment themselves, which seems to be the case here (mainly your comment here). This isn’t a bad thing, of course: you owe us nothing!

The best case scenario is that the library author is interested in owning and maintaining first-party types that ship with the library. The easiest way to accomplish this is to write the lib in typescript and compile to JS and type files, but that isn’t required of course.

The second best outcome is that the community maintains types over at DefiniteyTyped. Anyone can contribute, the bar for contribution is low (I contributed types and had them merged in days), and the types are very discoverable (TS will prompt TS users to install the types I contributed!).

The worst case scenario is you get half-baked or inaccurate types that ship with the lib and the maintainer stops bothering with PRs or is just slow to accept them. This sucks when it happens.

If you’re interested in going from that second category to the first one I can help you convert the codebase to TypeScript. It’s super easy. If you want to ship and maintain first-party types without converting your code (manually maintaining the types) I’d probably be willing to help you with that too, but you’d have to promise to maintain what I contribute and not let it get out of sync with the code (because in that case you’re better off just keeping them at DefinitelyTyped). Let me know!

altano commented 1 year ago

Types merged into DefinitelyTyped. Thanks everyone.