-
Notifications
You must be signed in to change notification settings - Fork 8
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
Adapt typings for Gnome 47 release #51
Conversation
At first, I struggled to solve errors due to double-exports. They were a direct result of dependency conflicts (i.e. some dependencies used beta.15 packages, while others used beta.16 packages and those imports were then intermixed). After the the latest commit 51eb4a5, everything works :). The only error that popped-up when upgrading the types was - as expected - the changed return type of Bottom line: This PR is good to be merged IMO. All typings work flawlessly with the gTile extension. |
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.
I believe the new types for getPreferencesWidget
and fillPreferencesWindow
are overly strict.
I've checked the GNOME Shell sources, and all GNOME Shell does with the return value of these functions, is await
ing them.
So they can actually return not just a Promise, but also any then-able object, or the corresponding plain type. Off the top of my head I don't know whether Typescript has a generic type to represent the permitted type for an await
'ed expression, tho.
That said, then-able objects are probably not an issue, because we don't have a library ecosystem and don't need to handle non-native or foreign promises.
But fillPreferencesWindow
should return Promise<void> | void
nonetheless. Otherwise typescript would require a Promise being returned, but I believe the vast majority of fillPreferencesWindow
implementations aren't async and do not actually need to return a Promise. Being forced to return Promise<void>
would be rather inconvenient for many extensions I presume.
I agree with that, and you can |
I agree on the
Yeah - although its sufficient to add an I don't know our policy on breaking changes to be honest. I tried to stay as close to the upstream API as possible. At the end of the day its a trade-off between (i) staying compatible with the upstream API and (ii) deviate deliberately from time to time in favor of ease-of-use/convenience. I have no strong opinion on that, other than option (ii) is hard(er) to maintain because we have to know whether the deviation breaks anything in the upstream implementation (e.g. when it's using Since both of you @swsnr and @Totto16 agree on the matter, I've added back the |
69148f2
to
431ccfa
Compare
I was referring to the GNOME Shell source code, not to the previous major version of these typings.
I'm not sure what you mean with this sentence. It's not as if we have a choice 😅 We must follow what GNOME Shell does. And all I was trying to say is that GNOME Shell just awaits the return values of these two functions, and since IOW, I don't care about breaking changes wrt to the previous major version of these typings, I care about modelling the types of the current major release accurately. |
431ccfa
to
4c35fc4
Compare
I was referring to the proposed change of the method signature from @Totto16 - Feel free to resolve the discussions above at your discretion. I've added the changes. |
@schnz Oh, I didn't notice the jsdoc comments. Most parts of Gnome shell don't have them, so I didn't bother to check the signature but instead went straight to the call site to see how it's actually used 😅 So disregard my comments. If we have type info we should probably follow it, shouldn't we? And just use |
4c35fc4
to
d3cc3b1
Compare
d3cc3b1
to
0ea740a
Compare
@Totto16 I've taken the liberty to merge this already 🙂 |
No worries, my change requests were non blocking 👍🏼 |
Based on the changes listed here: https://gjs.guide/extensions/upgrading/gnome-shell-47.html
I am going to test integration with gTile now and will report back whether I stumbled upon any errors.