holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.06k stars 85 forks source link

Typescript support / docs #55

Open JonasKruckenberg opened 4 years ago

JonasKruckenberg commented 4 years ago

I really like this module, I love that it is way simpler to use and understand than many other solutions out there. But I wish it would work better with typescript and all the other tooling out there. That's why I started working on 'porting' Hyperswarm to typescript on my fork, it's not yet complete and I'm probably also not the best typescript dev in existence, but it's a starting point that I use in my project. Since I think other users of the module might benefit from stuff that I've been doing i.e. typings, docs, etc. I thought I ask you what the wisest thing to do would be. Are you open to accepting a .d.ts file PR? Or should my fork be kept separate? I've generated a bit of WIP docs from the code as well, maybe that can be put to use somehow. I'm here to help make this module more accessible if that's possible! Cheers!

davidmarkclements commented 4 years ago

hey @JonasKruckenberg would you be willing to maintain a d.ts file long term?

I personally think d.ts files are great with just normal JS because of the intellisense benefits and ease integration for those who do use typescript. The only issue is that TypeScript moves forward as a language quite quickly so the d.ts files can quickly become outdated, not because of breaking library changes but because of breaking TypeScript changes. This is what I found with Pino anyway, eventually we removed the d.ts file as it became too contentious.

But if you're okay to commit to maintaining d.ts files each of the hyperswarm modules then I'm +1 on accepting a PR for a d.ts file on each repo

JonasKruckenberg commented 4 years ago

Yeah I think the majority of the work isn’t to maintain the typings but to create them in the first place, so yeah I‘m willing to maintain the typings long term. I’d could use some help creating explanations for the functions though, but I can count on your help there right?

What modules are you considering part of Hyperswarm that are worth getting typings? Hyperswarm, Discovery, Network, Dht and replicator are ones I was thinking of 🤔

Edit: Maybe also Hypercore should get typings in the long term, would be useful for the replicator repo, but that’s big task 😅

robbiemu commented 1 year ago

this still is a wanted feature!

robertotomas@MacBook-Pro-2 ttt-p2p % yarn add --dev @types/hyperswarm
yarn add v1.22.19
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@types%2fhyperswarm: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/robertotomas/Public/ttt-p2p/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
deanpress commented 1 year ago

+1 for typescript support!

eL1x00r commented 8 months ago

guys big thing, wen ?

Swepool commented 6 months ago

Any plans for this?