From 78e147290f02b76850c7e3d0904066679dc7d358 Mon Sep 17 00:00:00 2001 From: Siddharth VP Date: Sat, 6 Mar 2021 13:03:52 +0530 Subject: [PATCH] update readme; bump version --- README.md | 20 +++++++++++++++++--- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7f78d0f..66890d8 100644 --- a/README.md +++ b/README.md @@ -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/) @@ -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"; diff --git a/package-lock.json b/package-lock.json index 06ef6e1..884e8a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "types-mediawiki", - "version": "0.7.3", + "version": "0.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.7.3", + "version": "0.8.0", "license": "MIT", "dependencies": { "@types/jquery": "^3.5.5" diff --git a/package.json b/package.json index d713c39..a91e4f9 100644 --- a/package.json +++ b/package.json @@ -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": {