Skip to content

Commit

Permalink
Add types for mediawiki.deflate
Browse files Browse the repository at this point in the history
adapted from #32
  • Loading branch information
Adrien LESÉNÉCHAL committed Mar 8, 2024
1 parent 996aa4c commit 921457c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mw/deflate.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
declare global {
namespace mw {
/**
* Compress the content and add the 'rawdeflate,' prefix.
*
* @example
* ```js
* mw.loader.using( 'mediawiki.deflate' ).then( function () {
* var deflated = mw.deflate( myContent );
* } );
* ```
*
* @param {string|ArrayBuffer} data Undeflated data
* @returns {string} Deflated data
* @see https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki.deflate/mw.deflate.js#L3
* @see https://doc.wikimedia.org/mediawiki-core/master/php/classDeflate.html
*/
function deflate(data: string | ArrayBuffer): `rawdeflate,${string}`;
}
}

export {};
1 change: 1 addition & 0 deletions mw/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "./config";
import "./confirmCloseWindow";
import "./cookie";
import "./debug";
import "./deflate";
import "./ForeignApi";
import "./ForeignRest";
import "./global";
Expand Down

0 comments on commit 921457c

Please sign in to comment.