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

Write in TypeScript? #258

Closed
ORESoftware opened this issue Aug 23, 2019 · 4 comments
Closed

Write in TypeScript? #258

ORESoftware opened this issue Aug 23, 2019 · 4 comments

Comments

@ORESoftware
Copy link

ORESoftware commented Aug 23, 2019

I am looking for a WebSockets library written in TypeScript

https://www.quora.com/unanswered/Is-there-a-Websocket-library-for-Node-js-written-in-TypeScript

it looks like @types/sockjs exists, but since it's packaged separately, often the types become out-of-sync.

@brycekahle
Copy link
Contributor

brycekahle commented Aug 26, 2019

The benefit of using TypeScript for this library is small. FYI @types/sockjs is not maintained by SockJS folks either.

@ORESoftware
Copy link
Author

ORESoftware commented Aug 26, 2019

It's for the end user, more than anything, end user gets reliable types, whereas @types/sockjs is pretty reliably going to be out of sync. imo it's sort of criminal to not have types for a library when it's an available tool, maybe 50% of people are using VSCode or Jetbrains to do their JS stuff and both IDEs are well geared to handle .ts files.

@brycekahle
Copy link
Contributor

This library is stable, and the interface changes very infrequently, and then in backwards-compatible ways if possible.

imo it's sort of criminal to not have types for a library

Just because you want a feature, does not make it mandatory. This library is in maintenance mode. Changes are only made when the benefit outweighs the cost.

@ORESoftware
Copy link
Author

I understand. One benefit of TS is that you can introduce types gradually, but there is some cognitive overhead to managing a compile step.

You should be able to do something like this:

dist/
src/

and in src/ you have:

a.js
b.ts

and it will transpile to:

dist/
  a.js
  b.d.ts
  b.js

I am no the only one looking for libraries that go through the trouble of generating a typed interface, which easier to consume. I did a search for "websocket library written in typescript", and there aren't any as far as I can tell. 'ws' would be a good candidate for this and this library as well.

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

No branches or pull requests

2 participants