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

TypeScript conversion #1890

Open
garyhuntddn opened this issue Feb 18, 2022 · 19 comments
Open

TypeScript conversion #1890

garyhuntddn opened this issue Feb 18, 2022 · 19 comments

Comments

@garyhuntddn
Copy link
Contributor

TypeScript conversion and related pull requests

I suggest we have a single issue to collate issues around the conversion work I'm planning on doing (for anyone else - please feel free to help out).

I've got 30+ PRs prepared for a bunch of simple conversion from .js to .ts for the constants and the likes.

I've also written a policy document in a separate PR which needs a good review to see if you agree with me etc.

I'm also tempted to write a whole load of brittle tests (brittle because they test implementation rather than function) around each of the conversions that we'd then throw away after the conversion work is complete (they'll be here a fair while :-) ) This would be to ensure that we've not created any regressions.

Is there a consensus about the best way to approach this? we definitely want small PRs that should be aborted on the slightest sniff of a merge-conflict (it would indicate that the source .js changed prior to the merge).

Before I raise the PRs I feel it's worth having a quick discussion around the approach - I'm happy to lead, but happier still if I'm working with others' inputs to ensure that I'm making things as easy as possible for the maintainers.

@saghul
Copy link
Member

saghul commented Feb 18, 2022

I like the approach of small PRs, easier to make sure we don't miss things during review.

Tests would most certainly help too!

I'd suggest we get started with a PR or two and adjust the plan as necessary. It's virtually impossible to have everything fully thought through, so we can adapt.

Please @ me for a review when you post the first one and let's take it from there!

@garyhuntddn
Copy link
Contributor Author

3x PRs in place

I have 30+ additional PRs that follow this pattern that I'll submit if we're happy with what I've done so far

@garyhuntddn
Copy link
Contributor Author

Hmm - hold tight - I'm hitting a build error in jenkins - will go and investigate

@garyhuntddn
Copy link
Contributor Author

Cracked it - an issue with the packages.lock file - now sorted and the build is successful

@garyhuntddn
Copy link
Contributor Author

@saghul would you consider this change to the package file? It's a bit lazy on my behalf, but will ensure that my future PRs include the updated .d.ts files. The downside is a bit of CPU effort running the typescript compiler.

garyhuntddn:gh/ts/patch-039-tsc-before-karma

I'm also going to wait until PR 1891 is merged before I rebase the other branches and push them over to you. Having 1893 in place as well would make that a tiny bit more reliable.

@garyhuntddn
Copy link
Contributor Author

Right - I've got a process for updating these branches and PRs - apologies for the number of them - but hey ho :-)

@saghul
Copy link
Member

saghul commented Feb 21, 2022

I'd rather not have that one, sorry. And thanks a ton for the PRs!

@garyhuntddn
Copy link
Contributor Author

No probs - I've just added a script that runs does "tsc && npm run test" that does what I need :-)

@saghul
Copy link
Member

saghul commented Feb 21, 2022

Thanks for understanding.

@garyhuntddn
Copy link
Contributor Author

That's the bulk of the PRs in place - take a quick look at my comment against the one #1915

@saghul
Copy link
Member

saghul commented Feb 21, 2022

Dang, we got some work to do reviewing! Thanks a ton for all of this!

@garyhuntddn
Copy link
Contributor Author

The next steps are going to be much harder, and some will require clean-up of the js first

@garyhuntddn
Copy link
Contributor Author

A question about public vs internal code...

I feel like we could do with a definition of which parts of the code are part of it's public API (and therefore won't change without a major version jump) vs. code that is internal to the project and therefore subject to change.

Any thoughts on how we should make this clear to those consuming the library? eventually I guess we can re-export at the index.js level but for now would comments in the code do the trick - or is there a better option?

@saghul
Copy link
Member

saghul commented Feb 28, 2022

I feel like we could do with a definition of which parts of the code are part of it's public API (and therefore won't change without a major version jump) vs. code that is internal to the project and therefore subject to change.

Makes sense.

Any thoughts on how we should make this clear to those consuming the library? eventually I guess we can re-export at the index.js level but for now would comments in the code do the trick - or is there a better option?

I think so far we have used the _functionName syntax to express that. I guess we could turn that into private in TS terms.

Or do you have anything else in mind?

@garyhuntddn
Copy link
Contributor Author

garyhuntddn commented Feb 28, 2022 via email

@saghul
Copy link
Member

saghul commented Feb 28, 2022

Ah, I see what you mean. This is actually our public API: https://github.com/jitsi/lib-jitsi-meet/blob/master/JitsiMeetJS.js

Anything not exposed there or publicly accessible through exported objects is private.

Not sure how we can annotate stuff to reflect this though.

@garyhuntddn
Copy link
Contributor Author

garyhuntddn commented Feb 28, 2022 via email

@saghul
Copy link
Member

saghul commented Feb 28, 2022

Hum. We could use stripInternal and annotate stuff with /** @internal */.

@garyhuntddn
Copy link
Contributor Author

garyhuntddn commented Feb 28, 2022 via email

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