Skip to content

Commit

Permalink
update readme; bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Mar 6, 2021
1 parent d966500 commit 78e1472
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

TypeScript definitions for MediaWiki JS interface.

This package covers the functions in the `mw` global object, as well a few jQuery plugins used in MediaWiki core. This is a work in progress.
This package covers the functions and classes in the `mw` global object, as well a few jQuery plugins used in MediaWiki core. All commonly used parts of the interface are covered but as far as complete coverage is concerned, this is a work in progress.

[![Download stats](https://nodei.co/npm/types-mediawiki.png?downloads=true&downloadRank=true)](https://nodei.co/npm/types-mediawiki/)

Expand All @@ -30,9 +30,23 @@ You should be all set! `mw` will be available in the global scope. There is no n

**If you find any errors or have suggestions for more specific typings, please open a PR or file an issue.**

### Action API parameters
### mw.config

This package also provides typings for API request parameters for the [MediaWiki Action API](https://www.mediawiki.org/wiki/API:Main_page). API endpoints defined in MediaWiki core and by a number of extensions (the ones enabled on English Wikipedia) are covered. These aren't exported to the global scope, however. For usage, you need to import them. For example:
Types for mw.config are included:
```ts
let NS = mw.config.get('wgNamespaceNumber'); // NS gets type number
let pageName = mw.config.get('wgPageName'); // pageName gets type string
```

mw.config entries added by MediaWiki extensions can also be used but their type is not known, so they need to be explicitly cast:
```ts
let namespaces = mw.config.get('pageTriageNamespaces') as number[];
```
(`mw.config.get('pageTriageNamespaces')` gets the type `unknown` without a cast.)

### MediaWiki API parameters

This package also provides typings for API request parameters for the [MediaWiki Action API](https://www.mediawiki.org/wiki/API:Main_page). API endpoints defined in MediaWiki core and by a number of common extensions (the ones enabled on English Wikipedia) are covered. These aren't exported to the global scope, however. For usage, you need to import them. For example:

```ts
import type { ApiEditPageParams, ApiParseParams } from "types-mediawiki/api_params";
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "types-mediawiki",
"version": "0.7.3",
"version": "0.8.0",
"description": "TypeScript definitions for MediaWiki JS interface",
"types": "index.d.ts",
"scripts": {
Expand Down

0 comments on commit 78e1472

Please sign in to comment.