Dear all,
As we all know, TypeScript would bring a lot of convivence to front-end development by providing a static type system. Unfortunately, most of Wikimedia's front-end codebases do not ship with TypeScript definitions.
To address this problem, recently, I have been working on writing the TypeScript definitions of OOjs and OOUI. Definitions of the former have been published to DefinitelyTyped, which is an official store for TypeScript definitions, and npm (https://www.npmjs.com/package/@types/oojs) while those for the latter are still work in progress.
During the development, some challenges arose: 1. Currently I am the only owner of @types/oojs npm package. This means that any contributions to that package are required to be approved by me, and for contributions from myself they are required to be approved by a DefinitelyTyped maintainer, which could be a slow procedure. I believe it would help a lot if maintainers of OOjs/OOUI or other Wikimedians would like to be another owner, which also reduces the bus factor. 2. The TypeScript compiler cannot recognize OO.inheritClass() calls and extend the class in the type system correctly, thus you need to use type assertions to set up the type correctly. This would bring inconvenience for classes like OO.ui.Dialog which heavily use inheritance.
I am writing to seek solutions to these problems.
Best regards, diskdance
Hi diskdance,
thanks for working on such TypeScript definitions, I am also a big fan of static typing :)
I however think it would make the most sense to have the TypeScript definitions directly in the OOUI/OOjs repositories ...
Looking at https://phabricator.wikimedia.org/T263914 it really seems like TypeScript isn't yet embraced by MediaWiki as it should be ...
Sidenote regarding OO.inheritClass() ... I guess ideally the library would use actual ES6 classes and deprecate whatever OO.inheritClass() is (I am not that familiar with these libraries).
I am currently working on Python static typing for the MediaWiki Action API ... looking at [1] perhaps we should start a Wikimedia user group for developers interested in furthering static typing in and around Wikimedia and MediaWiki? I think at least it would be nice to establish some chat room around that topic ... I just created a Libera.Chat channel #wikimedia-static-typing I think you should be able to join via:
* IRC: irc://irc.libera.chat/wikimedia-static-typing, or * Matrix: https://matrix.to/#/#wikimedia-static-typing:libera.chat
Cheers, Martin (aka push-f)
[1]: https://meta.wikimedia.org/wiki/Wikimedia_Rust_developers_user_group
wikitech-l@lists.wikimedia.org