Page MenuHomePhabricator

Offer TypeScript declaration files for the MediaWiki Javascript API (MediaWiki API typings)
Open, Needs TriagePublicFeature


As a Wikipedia user script/gadget developer, I would like to have TypeScript declaration files for the MediaWiki Javascript API, so that developing is possible without having to constantly check the MediaWiki Documentation.
TypeScript declaration files are supported by many IDEs, which can provide type checking and autocomplete for user scripts. An example of a supporting IDE is VSCode.

Currently, MediaWiki is using JSDuck, and when the migration to JSDoc (T138401) is completed, declaration files can be automatically generated from the JSDoc.

If MediaWiki publishes the typings after generation, users like me are able to download and use the typings.

Prototypical implementations

Event Timeline

Hi @Sportzpikachu, thanks for taking the time to report this and welcome to Wikimedia Phabricator!

Unfortunately this Wikimedia Phabricator task lacks information.
If you have time and can still reproduce the situation: Please add a more complete description to this task.
That should be a specific example, basic context (what are "Typescript typings"? link welcome), and a use case.

You can edit the task description by clicking Edit Task. Ideally, a good description should allow any other person to follow these steps (without having to interpret steps) and see the same results. Problems that others can reproduce can get fixed faster. Thanks again!

daniel removed a project: Platform Engineering.
daniel added a subscriber: daniel.

There doesn't seem to be anything to do here for PET here. Please re-tag if it becomes clear that there is something for us to work on here.

Unfortunately closing this Phabricator task as no further information has been provided.

@Sportzpikachu: After you have provided the information asked for and if this still happens, please set the status of this task back to "Open" via the Add Action...Change Status dropdown. Thanks!

Sportzpikachu updated the task description. (Show Details)
Aklapper renamed this task from MediaWiki API typings to Offer TypeScript declaration files for the MediaWiki Javascript API (MediaWiki API typings).Nov 14 2020, 8:48 AM
Jdlrobson added a subscriber: Unknown Object (User).

@Lens0021 possibly.

My team has been experimenting with a definition in Vector and I am at the point that I was interested in using it elsewhere (WikimediaEvents).

I did take a look at types-mediawiki but it didn't quite cover the interfaces in Vector and WikimediaEvents hence this publish - I'd imagine eventually we'd want a @wikimedia scoped npm package.

The frontends standards group is a more appropriate tag here to work out who's using TypeScript, what the needs are, communicate this issue more broadly and find a common solution.

Change 670897 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Use centralized MediaWiki typescript definition

Change 670897 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Use centralized MediaWiki typescript definition

I looked over the two "prototypical implementations" mentioned in the task description now but they're bare-bones. Types-mediawiki is quite well-developed (even mw.config is typed thanks to this PR) A few obscure interfaces like mw.experiments aren't there, but can be easily added. @Jdlrobson Do you want to move this repo over to the wikimedia github organization? Then I suppose we can have it published under the wikimedia npm organization as well. I feel this would simplify matters for the wikimedia projects wishing to use TypeScript.

@SD0001 I'm happy with whatever is decided but it's not my decision to make. I'm hoping a decision will get made now T293125 is happening.

Regarding npm... yes I'll fix that shortly.