sockjs/sockjs-node

Write in TypeScript?

ORESoftware opened this issue · 4 comments

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.

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

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.

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.

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.