Add kompression types (#41289)

This commit is contained in:
Aankhen
2020-01-02 22:16:08 -08:00
committed by Ryan Cavanaugh
parent 827e5dac59
commit 856588d8d4
4 changed files with 63 additions and 0 deletions
+17
View File
@@ -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;
}
}
+22
View File
@@ -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,
})
);
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }