@types/koa-bodyparser: use any for Request.body

Also, fix Request.rawBody and library version.
This commit is contained in:
Hiroshi Ioka 2018-11-16 08:35:26 +09:00
parent 1733f6bed0
commit e4b6fecfdc
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,8 @@
// Type definitions for koa-bodyparser 5.0
// Type definitions for koa-bodyparser 4.2
// Project: https://github.com/koajs/bodyparser
// Definitions by: Jerry Chin <https://github.com/hellopao>, Anup Kishore <https://github.com/anup-2s>
// Definitions by: Jerry Chin <https://github.com/hellopao>
// Anup Kishore <https://github.com/anup-2s>
// Hiroshi Ioka <https://github.com/hirochachacha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@ -18,8 +20,8 @@ import * as Koa from "koa";
declare module "koa" {
interface Request {
body: {} | null | undefined;
rawBody: {} | null | undefined;
body: any;
rawBody: string;
}
}

View File

@ -7,6 +7,7 @@ app.use(bodyParser({ strict: false }));
app.use((ctx) => {
console.log(ctx.request.body);
console.log(ctx.request.body.ok);
console.log(ctx.request.rawBody);
});