# @types/named-routes

> TypeScript definitions for named-routes

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

## Install

```sh
npm install @types/named-routes
pnpm add @types/named-routes
yarn add @types/named-routes
bun add @types/named-routes
```

## 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 | 2.0.6 |
| Published | 2025-10-24 |
| First published | 2018-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51446 |
| Maintainers | types |

## Links

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

## Dependencies (2)

- [@types/express](https://npm.io/package/@types/express.md) *
- [@types/express-serve-static-core](https://npm.io/package/@types/express-serve-static-core.md) *

## Recent versions

- 2.0.6 (latest) — 2025-10-24
- 2.0.5 (ts5.1) — 2023-11-21
- 2.0.1 (ts3.6) — 2019-08-19
- 2.0.0 (ts2.2) — 2018-06-20
- 2.0.4 — 2023-11-07
- 2.0.3 — 2023-10-18
- 2.0.2 — 2023-09-23

## README

# Installation
> `npm install --save @types/named-routes`

# Summary
This package contains type definitions for named-routes (https://github.com/alubbe/named-routes#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/named-routes.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/named-routes/index.d.ts)
````ts
import express = require("express");

declare module "express-serve-static-core" {
    interface Application {
        namedRoutes: NamedRouter;
    }
    // eslint-disable-next-line @typescript-eslint/naming-convention
    interface IRouterMatcher<T> {
        (path: PathParams, name: string, ...handlers: RequestHandler[]): T;
        (path: PathParams, name: string, ...handlers: RequestHandlerParams[]): T;
    }
}

interface RouterOptions {
    caseSensitive: boolean;
}

interface RouteOptions {
    name: string;
    recursiveWildcard: boolean;
    caseSensitive: boolean;
    wildcardInPairs: boolean;
}

interface RouteParams {
    [key: string]: string | string[] | number | number[] | boolean | boolean[] | null;
}

declare class NamedRouter {
    constructor(options?: Partial<RouterOptions>);
    match(req: express.Request): boolean | object;
    add(
        method: string,
        path: string,
        callbacks: express.RequestHandler | express.RequestHandler[],
        options?: Partial<RouteOptions>,
    ): void;
    build(name: string, params?: RouteParams, method?: string): string;
    registerAppHelpers(app: express.Express): NamedRouter;
    param(name: string, callback: express.RequestHandler): NamedRouter;
    param(callback: express.RequestHandler): NamedRouter;
    dispatch(req: express.Request, res?: express.Response, next?: express.NextFunction): void;
    extendExpress(app: express.Express | express.Router): NamedRouter;
}

export = NamedRouter;

````

### Additional Details
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/express](https://npmjs.com/package/@types/express), [@types/express-serve-static-core](https://npmjs.com/package/@types/express-serve-static-core)

# Credits
These definitions were written by [Philipp Katz](https://github.com/qqilihq).

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