jcbrand on Nostr: Quite a while back, I read about how the #Svelte devs used JSDoc type hints together ...
Quite a while back, I read about how the #Svelte devs used JSDoc type hints together with the #TypeScript compiler to add types to Svelte while keeping the actual code #JavaScript.
I've decided to do the same with the #XMPP library Strophe.js
https://github.com/strophe/strophejs
Strophe now contains type declaration files generated from the JSDoc type hints (not yet released).
My experience is a bit mixed.
Writing JSDoc types is more verbose and feels a bit more clunky than writing TypeScript.
But on the other hand, you avoid introducing a compilation step and the code itself doesn't have to change much.
For relatively small libraries like Strophe it's worth considering.
I've decided to do the same with the #XMPP library Strophe.js
https://github.com/strophe/strophejs
Strophe now contains type declaration files generated from the JSDoc type hints (not yet released).
My experience is a bit mixed.
Writing JSDoc types is more verbose and feels a bit more clunky than writing TypeScript.
But on the other hand, you avoid introducing a compilation step and the code itself doesn't have to change much.
For relatively small libraries like Strophe it's worth considering.