mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #28468 from danwbyrne/koa-better-body
adds typings for the 'koa-better-body' package
This commit is contained in:
Vendored
+33
@@ -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);
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user