mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Add kompression types (#41289)
This commit is contained in:
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for kompression 1.0
|
||||
// Project: https://github.com/tuananh/kompression
|
||||
// Definitions by: Aankhen <https://github.com/Aankhen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import koa = require("koa");
|
||||
|
||||
export = kompression;
|
||||
|
||||
declare function kompression(options?: Kompression.Options): koa.Middleware;
|
||||
|
||||
declare namespace Kompression {
|
||||
interface Options {
|
||||
filter?: (contentType: string) => boolean;
|
||||
threshold?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import Koa = require("koa");
|
||||
import compress = require("kompression");
|
||||
|
||||
const app = new Koa();
|
||||
|
||||
app.use(
|
||||
compress()
|
||||
);
|
||||
|
||||
app.use(
|
||||
compress({})
|
||||
);
|
||||
|
||||
// based on README
|
||||
app.use(
|
||||
compress({
|
||||
filter(contentType) {
|
||||
return /text/i.test(contentType);
|
||||
},
|
||||
threshold: 2048,
|
||||
})
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"kompression-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user