Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/named-routes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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
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, @types/express-serve-static-core
Credits
These definitions were written by Philipp Katz.