Closed AnYiEE closed 1 year ago
Thanks for the PR and apologies for the delayed review.
mw.storage also has a setExpires() method which is missing here. All the 5 methods in mw.storage and mw.storage.session have the same types - is there a way we can avoid duplicating them?
The solution I came up with is not to declare the session namespace, but instead use "const session = typeof mw.storage". However, this would result in a loop of "mw.storage.session.session.session", even though we both know that nobody would use it like that, it's not the expected result. Unfortunately, I have not found a solution to this.
Anyway, I will continue to work on completing the type definitions you mentioned, and I hope you can release a version update as soon as possible after that. A few lines of repetitive statements do not affect usage, the lack of type definitions will definitely impact.
Thanks for your work.
The solution I came up with is not to declare the session namespace, but instead use "const session = typeof mw.storage". However, this would result in a loop of "mw.storage.session.session.session"
Generally, interfaces are used to avoid that kind of problem. Done now in latest commit.
Generally, interfaces are used to avoid that kind of problem. Done now in latest commit.
Your solution is effective. Thank you.
https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.storage