-
-
Notifications
You must be signed in to change notification settings - Fork 589
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
[BREAKING] Convert MatrixClient to TypeScript #1718
Conversation
425d823
to
56bf57b
Compare
@turt2live Thanks for working on this big change! 😄 One thing I've noticed with the current branch is Git seems unable to follow the .js -> .ts rename of |
I'll timebox doing that, but have little hope of it working. The conversion was deliberately done without a rename due to complexity of the source material: blame would have been lost regardless. This also merges two files into one, making it even harder for the blame to operate... |
2f812e4
to
bf9ba65
Compare
@jryans the commit history is a bit fucky, but the commit is there now - does it look okay/different to you? Github doesn't count it as a rename due to the massive file diff (+8432 -6057 on client.ts / client.js), but the commit trail seems to count it in my git tree. |
Thanks, looks like the line history is indeed now preserved across the rename at least locally (where it matters most), so that's great, thanks! 😁 |
I've grabbed this one from the queue explicitly... Will start on it after the sync meeting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 😄 Obviously I've only done a quick skim, but this is a great foundation, and I think it would be better to merge sooner (avoiding conflicts) and then improve from there.
brace for impact |
This is considered breaking due to an API contract change (merge of two classes): it is unknown if external consumers will have extended these classes.
Accompanied by matrix-org/matrix-react-sdk#6132
Reviewer: This is a massive diff, and one that doesn't line up with the old source. I would highly suggest doing a kind of review where simple sanity is checked rather than exact function definitions being translated to the right place.
Also, probably take breaks. It took over a week to write this, so will probably take a few hours to review.
This is unlikely to be reviewable commit-by-commit, sorry.
The approach for this started with optimism and quickly dwindled to being as much as a straight-through conversion as possible. This means that after the first little bit of the type conversion things started getting
// TODO: Types
instead of interfaces when they weren't plainly obvious. Trying to type everything out would likely make this PR literally impossible to review, so I've settled for comments for now.This also merges the MatrixBaseApis with MatrixClient given they were always the same thing. Nothing else extended MatrixBaseApis. This also saves us from having to use mixins/multiple
extends
, which is arguably a win. The downside is the MatrixClient class is even longer now.This includes a brief pass over jsdoc just to ensure the type warnings line up. No realistic effort was made to improve the state of the documentation as a whole.
Note: Groups have had the absolute bare minimum amount of effort, even going so far as to not document types or put TODOs on them. This is because they're being ripped out sooner than is worth documenting.
TODO:
Note: while I have verified that Element Web/Desktop doesn't explode, there's almost certainly areas I missed in manual testing. We should watch for bugs.