Ws: Write the library in TypeScript

Created on 23 Aug 2019  路  7Comments  路  Source: websockets/ws

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/ws exists, but since it's packaged separately, often the types become out-of-sync.

Most helpful comment

I respect the choice of not adding work to re-implement the library in typescript. But just wanted to correct that if the all the code is re-written in typescript, then there is no need to maintain type definitions separately.

Yes, type definitions will be generated automatically at compile time. Just write ts and run tsc is enough. This library does not depend on other libraries, it should not be difficult to write using TypeScript, maybe I can have a try if I'm free.

All 7 comments

case in point, latest version of the types is: @types/[email protected], latest version of the lib is 7.x.

@lpinca that twitter thread is about writing @types/ws which already exists. I am talking about writing the library itself in TS.

I looked at the codebase. All you have to do is transpile src to lib:

src -> lib

using TS, it's easy to do

I don't want to rewrite the lib in TypeScript, maintain type definitions, and add any additional transpile step, sorry.

I respect the choice of not adding work to re-implement the library in typescript. But just wanted to correct that if the all the code is re-written in typescript, then there is no need to maintain type definitions separately.

its possible that TS can target WebAssembly, so it might be a good idea :-)

I respect the choice of not adding work to re-implement the library in typescript. But just wanted to correct that if the all the code is re-written in typescript, then there is no need to maintain type definitions separately.

Yes, type definitions will be generated automatically at compile time. Just write ts and run tsc is enough. This library does not depend on other libraries, it should not be difficult to write using TypeScript, maybe I can have a try if I'm free.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yosiat picture yosiat  路  26Comments

RWander picture RWander  路  18Comments

wyzxxx123 picture wyzxxx123  路  20Comments

alexhultman picture alexhultman  路  66Comments

shacharz picture shacharz  路  15Comments