Merge pull request #28468 from danwbyrne/koa-better-body

adds typings for the 'koa-better-body' package
This commit is contained in:
Armando Aguirre
2018-08-29 15:39:55 -07:00
committed by GitHub
4 changed files with 66 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for koa-better-body 3.0
// Project: https://github.com/tunnckoCore/koa-better-body
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Context } from 'koa';
declare function KoaBetterBody(options?: KoaBetterBody.Options): KoaBetterBody.Body;
declare namespace KoaBetterBody {
interface Options {
fields?: boolean | string;
files?: boolean | string;
multipart?: boolean;
textLimit?: string;
formLimit?: string;
urlencodedLimit?: string;
jsonLimit?: string;
bufferLimit?: string;
jsonStrict?: boolean;
detectJSON?: () => any;
strict?: boolean;
delimiter?: symbol;
decodeURIComponent?: any;
maxKeys?: number;
buffer?: boolean;
}
type Body = (context: Context, next: () => void) => Generator;
}
export = KoaBetterBody;
@@ -0,0 +1,11 @@
import body = require('koa-better-body');
// $ExpectType Body
body();
const testOptions: body.Options = {
jsonLimit: '100mb',
};
// $ExpectType Body
body(testOptions);
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"koa-better-body-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}