# @types/koa-route

> TypeScript definitions for koa-route

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

## Install

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

## 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 | 3.2.9 |
| Published | 2025-10-24 |
| First published | 2017-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51444 |
| Maintainers | types |

## Links

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

## Dependencies (2)

- [@types/koa](https://npm.io/package/@types/koa.md) *
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^1.7.0

## Recent versions

- 3.2.9 (latest) — 2025-10-24
- 3.2.8 (ts5.1) — 2023-11-07
- 3.2.5 (ts4.2) — 2021-10-17
- 3.2.4 (ts3.5) — 2018-06-27
- 3.2.2 (ts2.2) — 2017-10-25
- 3.2.7 — 2023-10-18
- 3.2.6 — 2023-09-14
- 3.2.3 — 2017-11-09
- 3.2.1 — 2017-08-31
- 3.2.0 — 2017-05-04

## README

# Installation
> `npm install --save @types/koa-route`

# Summary
This package contains type definitions for koa-route (https://github.com/koajs/route#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-route.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-route/index.d.ts)
````ts
import Koa = require("koa");
import pathToRegexp = require("path-to-regexp");

declare namespace KoaRoute {
    type Path = string | RegExp | Array<string | RegExp>;

    /**
     * The Koa handler will receive parameters extracted from the route as extra arguments.
     */
    type Handler = (this: Koa.Context, ctx: Koa.Context, ...params: any[]) => any;

    type CreateRoute = (routeFunc: Handler) => Koa.Middleware;

    interface Method {
        (path: Path): CreateRoute;
        (path: Path, fn: Handler, opts?: pathToRegexp.ParseOptions & pathToRegexp.RegExpOptions): Koa.Middleware;
    }

    type CreateMethod = (method: string) => Method;

    interface Routes {
        all: Method;
        acl: Method;
        bind: Method;
        checkout: Method;
        connect: Method;
        copy: Method;
        delete: Method;
        del: Method;
        get: Method;
        head: Method;
        link: Method;
        lock: Method;
        msearch: Method;
        merge: Method;
        mkactivity: Method;
        mkcalendar: Method;
        mkcol: Method;
        move: Method;
        notify: Method;
        options: Method;
        patch: Method;
        post: Method;
        propfind: Method;
        proppatch: Method;
        purge: Method;
        put: Method;
        rebind: Method;
        report: Method;
        search: Method;
        subscribe: Method;
        trace: Method;
        unbind: Method;
        unlink: Method;
        unlock: Method;
        unsubscribe: Method;
    }
}

declare const routes: KoaRoute.Routes;

export = routes;

````

### Additional Details
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa), [path-to-regexp](https://npmjs.com/package/path-to-regexp)

# Credits
These definitions were written by [Mike Cook](https://github.com/migstopheles), and [Jaco Greeff](https://github.com/jacogr).

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