Installation
npm install --save @types/koa-bodyparser
Summary
This package contains type definitions for koa-bodyparser (https://github.com/koajs/body-parser).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser.
import Koa = require("koa");
declare module "koa" {
interface Request {
body?: unknown;
rawBody: string;
}
}
declare function bodyParser(opts?: bodyParser.Options): Koa.Middleware;
declare namespace bodyParser {
interface Options {
enableTypes?: string[] | undefined;
encoding?: string | undefined;
formLimit?: string | undefined;
jsonLimit?: string | undefined;
textLimit?: string | undefined;
xmlLimit?: string | undefined;
strict?: boolean | undefined;
detectJSON?: ((ctx: Koa.Context) => boolean) | undefined;
extendTypes?: {
json?: string[] | string | undefined;
form?: string[] | string | undefined;
text?: string[] | string | undefined;
} | undefined;
onerror?: ((err: Error, ctx: Koa.Context) => void) | undefined;
}
}
export = bodyParser;
Additional Details
- Last updated: Fri, 24 Oct 2025 04:02:41 GMT
- Dependencies: @types/koa
Credits
These definitions were written by Jerry Chin, Hiroshi Ioka, Alexi Maschas, and Pirasis Leelatanon.