medooze / whip-whep-js

WHIP and WHEP clients javascript module
MIT License
65 stars 15 forks source link

Typescriptify whip.js and whep.js ? #11

Closed cameronelliott closed 11 months ago

cameronelliott commented 11 months ago

@murillo128 how do you feel about having whip.js and whep.js inTypescript? I don't feel strongly one way or the other, but as I am writing type files for both WHIPClient and WHEPClient, in order to use them in Typescript, I am wondering if they should be in Typescript.

Do you have any thoughts?

murillo128 commented 11 months ago

I don't think I would rewrite the lib in typescript, but I am not against adding typescript inline annotations as we have done in https://github.com/medooze/semantic-sdp-js

cameronelliott commented 11 months ago

There is now a PR for adding typescript type definition files for both whip and whep. It looks like in semantic-sdp-js typescript type information was added using the JSDoc commenting method.

I didn't do that here, since there isn't even a build script etc yet, I just dropped in the typescript xxx.d.ts files which get searched for and used if found by tsc. This seemed to solve my typescript errors when using either whip.js or whep.js in a typescript project.

murillo128 commented 11 months ago

done in https://github.com/medooze/whip-whep-js/commit/fd5508e503252cea1879a6894cb4c12f26ed91a6