diff --git a/README.md b/README.md index ca30a1d..e429444 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ [![NPM version](https://img.shields.io/npm/v/types-mediawiki.svg)](https://www.npmjs.com/package/types-mediawiki) ![Linter](https://github.com/wikimedia-gadgets/types-mediawiki/workflows/Lint/badge.svg) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) # types-mediawiki TypeScript definitions for MediaWiki JS interface. -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. +This package covers the functions and classes in the `mw` global object, as well some jQuery plugins used in MediaWiki core. All commonly used parts of the interface are covered. + +[`@types/jquery`](https://www.npmjs.com/package/@types/jquery) and [`@types/oojs-ui`](https://www.npmjs.com/package/@types/oojs-ui) from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) are included as dependencies, so you don't need to install them separately. [![Download stats](https://nodei.co/npm/types-mediawiki.png?downloads=true&downloadRank=true)](https://nodei.co/npm/types-mediawiki/) @@ -25,7 +28,7 @@ Edit your project's `tsconfig.json` file so that it includes ] ``` -You should be all set! `mw` will be available in the global scope. There is no need to put any import statements in the TypeScript source files. This package includes [@types/jquery](https://www.npmjs.com/package/@types/jquery) as a dependency, so you don't need to install that separately. +You should be all set! `mw` will be available in the global scope. There is no need to put any import statements in the TypeScript source files. **If you find any errors or have suggestions for more specific typings, please open a PR or file an issue.** @@ -56,11 +59,3 @@ import type { ApiEditPageParams, ApiParseParams } from "types-mediawiki/api_para Since it is just a type import, it doesn't generate any JavaScript. Hence, such imports can also be used in non-modular applications. -## Types for OOjs & OOUI -TypeScript definitions of OOjs and OOUI is available on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) and npm as [`@types/oojs`](https://www.npmjs.com/package/@types/oojs) and [`@types/oojs-ui`](https://www.npmjs.com/package/@types/oojs-ui) packages. - -## TODO -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) - -- Add doc comments for `mw.Title`, `mw.Uri`, `mw.storage`, `mw.language` and `mw.loader`. -- Add types for more jQuery plugins. diff --git a/mw/hook.d.ts b/mw/hook.d.ts index c9fe93b..f420465 100644 --- a/mw/hook.d.ts +++ b/mw/hook.d.ts @@ -1,5 +1,7 @@ +import { User } from "./user"; + /** - * Registry and firing of events. + * An instance of a hook, created via {@link mw.hook mw.hook method}. * * MediaWiki has various interface components that are extended, enhanced * or manipulated in some other way by extensions, gadgets and even @@ -43,7 +45,7 @@ */ interface Hook { /** - * Register a hook handler + * Register a hook handler. * * @param {...Function} handler Function to bind. * @chainable @@ -51,7 +53,7 @@ interface Hook { add(...handler: Array<(...data: T) => any>): this; /** - * Run a hook. + * Call hook handlers with data. * * @param {*} data * @chainable @@ -59,7 +61,7 @@ interface Hook { fire(...data: T): this; /** - * Unregister a hook handler + * Unregister a hook handler. * * @param {...Function} handler Function to unbind. * @chainable @@ -67,16 +69,255 @@ interface Hook { remove(...handler: Array<(...data: T) => any>): this; } +interface PostEditData { + /** + * Message that listeners should use when displaying notifications. + * String for plain text, use array or jQuery object to pass actual nodes. + */ + message?: string | JQuery | HTMLElement[]; + /** + * User that made the edit. + */ + user?: string | User; + /** + * Whether a temporary user account was created. + */ + tempUserCreated?: boolean; +} + +interface SearchIndex { + [k: string]: SearchIndexEntry[]; +} + +interface SearchIndexEntry { + $highlight: JQuery; + $field: JQuery; + $wrapper: JQuery; + $tabPanel: JQuery; +} + +interface EditRecovery { + fieldChangeHandler(): void; +} + declare global { namespace mw { /** * Create an instance of mw.hook. * - * @method hook - * @member mw * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook */ - function hook(event: string): Hook; + function hook( + event: "apisandbox.formatRequest" + ): Hook< + [ + items: OO.ui.MenuOptionWidget[], + displayParams: object, + rawParams: object, + method: string, + ajaxOptions: JQuery.AjaxSettings + ] + >; + + /** + * Create an instance of mw.hook, fired after EditRecovery has loaded any recovery data, added event handlers, etc. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "editRecovery.loadEnd"): Hook<[editRecovery: EditRecovery]>; + + /** + * Create an instance of mw.hook. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "htmlform.enhance"): Hook<[$root: JQuery]>; + + /** + * Create an instance of mw.hook, fired after an edit was successfully saved. + * + * Does not fire for null edits. + * + * Code that fires the postEdit hook should first set `wgRevisionId` and `wgCurRevisionId` to the revision associated with the edit that triggered the postEdit hook, then fire the postEdit hook, e.g.: + * + * ``` + * mw.config.set( { + * wgCurRevisionId: data.newrevid, + * wgRevisionId: data.newrevid + * } ); + * // Now fire the hook. + * mw.hook( 'postEdit' ).fire(); + * ``` + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "postEdit"): Hook<[data?: PostEditData]>; + + /** + * Create an instance of mw.hook, fired after the listener for #postEdit removes the notification. + * + * @deprecated + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "postEdit.afterRemoval"): Hook<[]>; + + /** + * Create an instance of mw.hook. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "prefs.search.buildIndex"): Hook<[index: SearchIndex]>; + + /** + * Create an instance of mw.hook, fired when a trusted UI element to perform a logout has been activated. + * + * This will end the user session, and either redirect to the given URL on success, or queue an error message via mw.notification. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "skin.logout"): Hook<[href: string]>; + + /** + * Create an instance of mw.hook, fired when initialization of the filtering interface for changes list is complete. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "structuredChangeFilters.ui.initialized"): Hook<[]>; + + /** + * Create an instance of mw.hook, fired when a portlet is successfully created. + * + * Example usage: + * + * ``` + * mw.hook( 'util.addPortlet' ).add( ( p ) => { + * p.style.border = 'solid 1px black'; + * } ); + * ``` + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook( + event: "util.addPortlet" + ): Hook<[portlet: HTMLElement, before: string | undefined]>; + + /** + * Create an instance of mw.hook, fired when a portlet link is successfully created. + * + * Example usage: + * + * ``` + * mw.hook( 'util.addPortletLink' ).add( ( link ) => { + * const span = $( '' ); + * link.appendChild( span ); + * } ); + * ``` + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "util.addPortletLink"): Hook<[item: HTMLLIElement, data: object]>; + + /** + * Create an instance of mw.hook, fired when categories are being added to the DOM. + * + * It is encouraged to fire it before the main DOM is changed (when $content is still detached). However, this order is not defined either way, so you should only rely on $content itself. + * + * This includes the ready event on a page load (including post-edit loads) and when content has been previewed with LivePreview. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.categories"): Hook<[$content: JQuery]>; + + /** + * Create an instance of mw.hook, fired after collapsible content has been initialized. + * + * This gives an option to modify the collapsible behavior. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.collapsibleContent"): Hook<[$collapsible: JQuery]>; + + /** + * Create an instance of mw.hook, fired when wiki content has been added to the DOM. + * + * This should only be fired after $content has been attached. + * + * This includes the ready event on a page load (including post-edit loads) and when content has been previewed with LivePreview. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.content"): Hook<[$content: JQuery]>; + + /** + * Create an instance of mw.hook, fired when a diff is added to a page or dynamically displayed to the user. + * + * Similar to the wikipage.content hook, `$diff` may still be detached when the hook is fired. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.diff"): Hook<[$table: JQuery]>; + + /** + * Create an instance of mw.hook. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook( + event: "wikipage.diff.diffTypeSwitch" + ): Hook<[inlineToggleSwitch: OO.ui.ToggleSwitchWidget]>; + + /** + * Create an instance of mw.hook. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.diff.wikitextBodyUpdate"): Hook<[$wikitextDiffBody: JQuery]>; + + /** + * Create an instance of mw.hook, fired when the editform is added to the edit page. + * + * Similar to the wikipage.content hoo $editForm can still be detached when this hook is fired. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.editform"): Hook<[$editForm: JQuery]>; + + /** + * Create an instance of mw.hook, fired when a page's {@link https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Page_status_indicators status indicators} are being added to the DOM or updated. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.indicators"): Hook<[$indicators: JQuery]>; + + /** + * Create an instance of mw.hook, fired when dynamic changes have been made to the table of contents. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(event: "wikipage.tableOfContents"): Hook<[sections: any[]]>; + + /** + * Create an instance of mw.hook, fired when the page watch status has changed. + * + * Example usage: + * ``` + * mw.hook( 'wikipage.watchlistChange' ).add( ( isWatched, expiry, expirySelected ) => { + * // Do things + * } ); + * ``` + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook( + event: "wikipage.watchlistChange" + ): Hook<[isWatched: boolean, expiry: string, expirySelected: string]>; + + /** + * Create an instance of mw.hook. + * + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook + */ + function hook(name: string): Hook; } } diff --git a/mw/user.d.ts b/mw/user.d.ts index 6b78986..2a4fba1 100644 --- a/mw/user.d.ts +++ b/mw/user.d.ts @@ -1,168 +1,168 @@ +export interface User { + /** + * @property {Map} + * @see: https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-property-options + */ + // TODO: add types for items in the options map + options: mw.Map; + + /** + * @property {mw.Map} + * @see: https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-property-tokens + */ + tokens: mw.Map<{ + csrfToken: string; + patrolToken: string; + watchToken: string; + }>; + + /** + * Generate a random user session ID. + * + * This information would potentially be stored in a cookie to identify a user during a + * session or series of sessions. Its uniqueness should not be depended on unless the + * browser supports the crypto API. + * + * Known problems with Math.random(): + * Using the Math.random function we have seen sets + * with 1% of non uniques among 200,000 values with Safari providing most of these. + * Given the prevalence of Safari in mobile the percentage of duplicates in + * mobile usages of this code is probably higher. + * + * Rationale: + * We need about 80 bits to make sure that probability of collision + * on 155 billion is <= 1% + * + * See https://en.wikipedia.org/wiki/Birthday_attack#Mathematics + * n(p;H) = n(0.01,2^80)= sqrt (2 * 2^80 * ln(1/(1-0.01))) + * + * @return {string} 80 bit integer in hex format, padded + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-generateRandomSessionId + */ + generateRandomSessionId(): string; + + /** + * Get the current user's groups + * + * @param {Function} [callback] + * @return {JQuery.Promise} + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getGroups + */ + getGroups(callback?: (groups: string[]) => any): JQuery.Promise; + + /** + * Get the current user's database id + * + * Not to be confused with #id. + * + * @return {number} Current user's id, or 0 if user is anonymous + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getId + */ + getId(): number; + + /** + * Get the current user's name + * + * @return {string|null} User name string or null if user is anonymous + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getName + */ + getName(): string | null; + + /** + * A sticky generateRandomSessionId for the current JS execution context, + * cached within this class (also known as a page view token). + * + * @since 1.32 + * @return {string} 80 bit integer in hex format, padded + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getPageviewToken + */ + getPageviewToken(): string; + + /** + * Get date user registered, if available + * + * @return {boolean|null|Date} False for anonymous users, null if data is + * unavailable, or Date for when the user registered. + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getRegistration + */ + getRegistration(): boolean | null | Date; + + /** + * Get the current user's rights + * + * @param {Function} [callback] + * @return {JQuery.Promise} + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getRights + */ + getRights(callback?: (rights: string[]) => any): JQuery.Promise; + + /** + * Get the current user's name or the session ID + * + * Not to be confused with #getId. + * + * @return {string} User name or random session ID + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-id + */ + id(): string; + + /** + * Whether the current user is anonymous + * + * @return {boolean} + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-isAnon + */ + isAnon(): boolean; + + /** + * Is the user a normal non-temporary registered user? + * + * @return {boolean} + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-isNamed + */ + isNamed(): boolean; + + /** + * Is the user an autocreated temporary user? + * + * @return {boolean} + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-isTemp + */ + isTemp(): boolean; + + /** + * Retrieve a random ID, generating it if needed + * + * This ID is shared across windows, tabs, and page views. It is persisted + * for the duration of one browser session (until the browser app is closed), + * unless the user evokes a "restore previous session" feature that some browsers have. + * + * **Note:** Server-side code must never interpret or modify this value. + * + * @return {string} Random session ID + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-sessionId + */ + sessionId(): string; + + /** + * Get the current user's groups or rights + * + * @private + * @return {JQuery.Promise} + * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getUserInfo + */ + getUserInfo(): JQuery.Promise<{ + groups: string[]; + rights: string[]; + }>; +} + declare global { namespace mw { /** - * @class mw.user - * @singleton * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user */ - namespace user { - /** - * @property {Map} - * @see: https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-property-options - */ - // TODO: add types for items in the options map - const options: Map; - - /** - * @property {Map} - * @see: https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-property-tokens - */ - const tokens: Map<{ - csrfToken: string; - patrolToken: string; - watchToken: string; - }>; - - /** - * Generate a random user session ID. - * - * This information would potentially be stored in a cookie to identify a user during a - * session or series of sessions. Its uniqueness should not be depended on unless the - * browser supports the crypto API. - * - * Known problems with Math.random(): - * Using the Math.random function we have seen sets - * with 1% of non uniques among 200,000 values with Safari providing most of these. - * Given the prevalence of Safari in mobile the percentage of duplicates in - * mobile usages of this code is probably higher. - * - * Rationale: - * We need about 80 bits to make sure that probability of collision - * on 155 billion is <= 1% - * - * See https://en.wikipedia.org/wiki/Birthday_attack#Mathematics - * n(p;H) = n(0.01,2^80)= sqrt (2 * 2^80 * ln(1/(1-0.01))) - * - * @return {string} 80 bit integer in hex format, padded - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-generateRandomSessionId - */ - function generateRandomSessionId(): string; - - /** - * Get the current user's groups - * - * @param {Function} [callback] - * @return {JQuery.Promise} - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getGroups - */ - function getGroups(callback?: (groups: string[]) => any): JQuery.Promise; - - /** - * Get the current user's database id - * - * Not to be confused with #id. - * - * @return {number} Current user's id, or 0 if user is anonymous - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getId - */ - function getId(): number; - - /** - * Get the current user's name - * - * @return {string|null} User name string or null if user is anonymous - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getName - */ - function getName(): string | null; - - /** - * A sticky generateRandomSessionId for the current JS execution context, - * cached within this class (also known as a page view token). - * - * @since 1.32 - * @return {string} 80 bit integer in hex format, padded - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getPageviewToken - */ - function getPageviewToken(): string; - - /** - * Get date user registered, if available - * - * @return {boolean|null|Date} False for anonymous users, null if data is - * unavailable, or Date for when the user registered. - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getRegistration - */ - function getRegistration(): boolean | null | Date; - - /** - * Get the current user's rights - * - * @param {Function} [callback] - * @return {JQuery.Promise} - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getRights - */ - function getRights(callback?: (rights: string[]) => any): JQuery.Promise; - - /** - * Get the current user's name or the session ID - * - * Not to be confused with #getId. - * - * @return {string} User name or random session ID - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-id - */ - function id(): string; - - /** - * Whether the current user is anonymous - * - * @return {boolean} - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-isAnon - */ - function isAnon(): boolean; - - /** - * Is the user a normal non-temporary registered user? - * - * @return {boolean} - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-isNamed - */ - function isNamed(): boolean; - - /** - * Is the user an autocreated temporary user? - * - * @return {boolean} - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-isTemp - */ - function isTemp(): boolean; - - /** - * Retrieve a random ID, generating it if needed - * - * This ID is shared across windows, tabs, and page views. It is persisted - * for the duration of one browser session (until the browser app is closed), - * unless the user evokes a "restore previous session" feature that some browsers have. - * - * **Note:** Server-side code must never interpret or modify this value. - * - * @return {string} Random session ID - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-sessionId - */ - function sessionId(): string; - - /** - * Get the current user's groups or rights - * - * @private - * @return {JQuery.Promise} - * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.user-method-getUserInfo - */ - function getUserInfo(): JQuery.Promise<{ - groups: string[]; - rights: string[]; - }>; - } + const user: User; } } diff --git a/package-lock.json b/package-lock.json index 4fbbd74..dd23cd4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "1.5.0", "license": "GPL-3.0-or-later", "dependencies": { - "@types/jquery": "^3.5.5" + "@types/jquery": "^3.5.5", + "@types/oojs-ui": "^0.46.0" }, "devDependencies": { "dtslint": "^4.0.6", @@ -17,7 +18,7 @@ "lint-staged": "^10.5.3", "prettier": "^2.2.1", "tslint-config-prettier": "^1.18.0", - "typescript": "^4.1.3" + "typescript": "^4.2.2" } }, "node_modules/@babel/code-frame": { @@ -113,6 +114,20 @@ "integrity": "sha512-yj0DOaQeUrk3nJ0bd3Y5PeDRJ6W0r+kilosLA+dzF3dola/o9hxhMSg2sFvVcA2UHS5JSOsZp4S0c1OEXc4m1Q==", "dev": true }, + "node_modules/@types/oojs": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@types/oojs/-/oojs-7.0.6.tgz", + "integrity": "sha512-e6UBEoqJ3bLBvxtPnaFmqkK4HzPwrS3sqfB2dORUmAaShp/T7WhMoYjlwhe+7g748qv7eeX/q4WdOaeeVG2LtA==" + }, + "node_modules/@types/oojs-ui": { + "version": "0.46.4", + "resolved": "https://registry.npmjs.org/@types/oojs-ui/-/oojs-ui-0.46.4.tgz", + "integrity": "sha512-tpQyPjxr6FhMRNaactbjNXkr4uCsKNQMOVNJiAO5AvzxoPddChNZp4gG37Pm80jAeDP11k9ww4durnEjzqqKsQ==", + "dependencies": { + "@types/jquery": "*", + "@types/oojs": "*" + } + }, "node_modules/@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -3063,9 +3078,9 @@ "dev": true }, "node_modules/typescript": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", - "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz", + "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -3444,6 +3459,20 @@ "integrity": "sha512-yj0DOaQeUrk3nJ0bd3Y5PeDRJ6W0r+kilosLA+dzF3dola/o9hxhMSg2sFvVcA2UHS5JSOsZp4S0c1OEXc4m1Q==", "dev": true }, + "@types/oojs": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@types/oojs/-/oojs-7.0.6.tgz", + "integrity": "sha512-e6UBEoqJ3bLBvxtPnaFmqkK4HzPwrS3sqfB2dORUmAaShp/T7WhMoYjlwhe+7g748qv7eeX/q4WdOaeeVG2LtA==" + }, + "@types/oojs-ui": { + "version": "0.46.4", + "resolved": "https://registry.npmjs.org/@types/oojs-ui/-/oojs-ui-0.46.4.tgz", + "integrity": "sha512-tpQyPjxr6FhMRNaactbjNXkr4uCsKNQMOVNJiAO5AvzxoPddChNZp4gG37Pm80jAeDP11k9ww4durnEjzqqKsQ==", + "requires": { + "@types/jquery": "*", + "@types/oojs": "*" + } + }, "@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -5795,9 +5824,9 @@ "dev": true }, "typescript": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", - "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz", + "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==", "dev": true }, "universalify": { diff --git a/package.json b/package.json index 709779a..39a67a4 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ }, "homepage": "https://github.com/wikimedia-gadgets/types-mediawiki#readme", "dependencies": { - "@types/jquery": "^3.5.5" + "@types/jquery": "^3.5.5", + "@types/oojs-ui": "^0.46.0" }, "devDependencies": { "dtslint": "^4.0.6", @@ -31,7 +32,7 @@ "lint-staged": "^10.5.3", "prettier": "^2.2.1", "tslint-config-prettier": "^1.18.0", - "typescript": "^4.1.3" + "typescript": "^4.2.2" }, "husky": { "hooks": {