# @types/koa-joi-router

> TypeScript definitions for koa-joi-router

Latest version **8.0.8** (published 2025-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/koa-joi-router
pnpm add @types/koa-joi-router
yarn add @types/koa-joi-router
bun add @types/koa-joi-router
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 8.0.8 |
| Published | 2025-10-24 |
| First published | 2017-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51437 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/koa-joi-router
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-joi-router
- npm.io page: https://npm.io/package/@types/koa-joi-router

## Dependencies (6)

- [joi](https://npm.io/package/joi.md) ^17.3.0
- [@types/koa](https://npm.io/package/@types/koa.md) *
- [@types/node](https://npm.io/package/@types/node.md) *
- [@types/busboy](https://npm.io/package/@types/busboy.md) *
- [@types/co-body](https://npm.io/package/@types/co-body.md) *
- [@types/koa-router](https://npm.io/package/@types/koa-router.md) *

## Recent versions

- 8.0.8 (latest) — 2025-10-24
- 8.0.7 (ts5.1) — 2023-11-07
- 8.0.4 (ts3.8) — 2022-01-06
- 8.0.3 (ts3.7) — 2021-10-23
- 8.0.1 (ts3.6) — 2021-07-08
- 8.0.0 (ts3.5) — 2021-05-11
- 5.2.5 (ts3.4) — 2021-01-14
- 5.2.4 (ts3.3) — 2020-10-10
- 5.2.3 (ts2.8) — 2019-11-07
- 5.2.2 (ts2.4) — 2019-04-23
- 5.0.0 (ts2.0) — 2017-11-06
- 8.0.6 — 2023-10-18
- 8.0.5 — 2023-09-14
- 8.0.2 — 2021-09-14
- 5.2.1 — 2019-02-12
- … 6 more at https://npm.io/package/@types/koa-joi-router/versions

## README

# Installation
> `npm install --save @types/koa-joi-router`

# Summary
This package contains type definitions for koa-joi-router (https://github.com/koajs/joi-router).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-joi-router.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-joi-router/index.d.ts)
````ts
/// <reference types="node" />

import { BusboyConfig } from "busboy";
import CoBody = require("co-body");
import * as http from "http";
import * as Joi from "joi";
import Koa = require("koa");
import KoaRouter = require("koa-router");

declare module "koa" {
    interface Request {
        body?: any;
        params: { [key: string]: string };
    }
}

interface createRouter {
    (): createRouter.Router;
    Joi: typeof Joi;
}

declare namespace createRouter {
    type FullHandler = (ctx: Koa.Context, next: Koa.Next) => any;
    interface NestedHandler extends ReadonlyArray<Handler> {}
    type Handler = FullHandler | NestedHandler;

    type Method = (path: string | RegExp, handlerOrConfig: Handler | Config, ...handlers: Handler[]) => Router;

    type OutputValidation = { body: Joi.SchemaLike } | { headers: Joi.SchemaLike };

    interface Config {
        pre?: Handler | undefined;
        validate?:
            | {
                header?: Joi.SchemaLike | undefined;
                query?: Joi.SchemaLike | undefined;
                params?: Joi.SchemaLike | undefined;
                body?: Joi.SchemaLike | undefined;
                maxBody?: number | string | undefined;
                failure?: number | undefined;
                type?: "form" | "json" | "multipart" | undefined;
                formOptions?: CoBody.Options | undefined;
                jsonOptions?: CoBody.Options | undefined;
                multipartOptions?: BusboyConfig | undefined;
                output?: { [status: string]: OutputValidation } | undefined;
                continueOnError?: boolean | undefined;
                validateOptions?: Joi.ValidationOptions | undefined;
            }
            | undefined;
        meta?: any;
    }

    interface Spec extends Config {
        method: string | string[];
        path: string | RegExp;
        handler: Handler;
    }

    interface Router {
        routes: Spec[];
        route(spec: Spec | Spec[]): Router;
        router: KoaRouter;
        middleware(): Koa.Middleware;

        prefix: KoaRouter["prefix"];
        use: KoaRouter["use"];
        param: KoaRouter["param"];

        head: Method;
        options: Method;
        get: Method;
        post: Method;
        put: Method;
        patch: Method;
        delete: Method;
    }
}

declare var createRouter: createRouter;

export = createRouter;

````

### Additional Details
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/busboy](https://npmjs.com/package/@types/busboy), [@types/co-body](https://npmjs.com/package/@types/co-body), [@types/koa](https://npmjs.com/package/@types/koa), [@types/koa-router](https://npmjs.com/package/@types/koa-router), [@types/node](https://npmjs.com/package/@types/node), [joi](https://npmjs.com/package/joi)

# Credits
These definitions were written by [Matthew Bull](https://github.com/wingsbob), [Dave Welsh](https://github.com/move-zig), [Hiroshi Ioka](https://github.com/hirochachacha), [Tiger Oakes](https://github.com/NotWoods), and [Jeremy Hull](https://github.com/sourrust).

---
_Source: https://npm.io/package/@types/koa-joi-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
