1
4

2 回答 2

1

尝试将它包装在一个名为 'named-routes' 的模块中,如下所示:

declare module 'named-routes' {
  import { IRouterMatcher } from 'express';
  import { PathParams, RequestHandler, RequestHandlerParams } from 'express-serve-static-core';

  module 'express-serve-static-core' {
    export interface IRouterMatcher<T> {
    // copied from existing decl. and added the `name` argument
      (path: PathParams, name: string, ...handlers: RequestHandler[]): T;
      (path: PathParams, name: string, ...handlers: RequestHandlerParams[]): T;
    }
  }
}
于 2018-03-16T12:10:21.050 回答
1
于 2018-06-22T15:12:28.933 回答