Skip to content

Commit

Permalink
fix(typings): add regexp as type of path (#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
xujihui1985 authored and atian25 committed Mar 5, 2018
1 parent b55e908 commit 1a73720
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ declare interface EggApplication extends KoaApplication { // tslint:disable-line
url(name: string, params: any): any;
}

type RouterPath = string | RegExp;

export interface Application extends EggApplication {
/**
* global locals for view
Expand All @@ -504,26 +506,26 @@ export interface Application extends EggApplication {
/**
* HTTP get method
*/
get(path: string, fn: string): void;
get(path: string, ...middleware: any[]): void;
get(path: RouterPath, fn: string): void;
get(path: RouterPath, ...middleware: any[]): void;

/**
* HTTP post method
*/
post(path: string, fn: string): void;
post(path: string, ...middleware: any[]): void;
post(path: RouterPath, fn: string): void;
post(path: RouterPath, ...middleware: any[]): void;

/**
* HTTP put method
*/
put(path: string, fn: string): void;
put(path: string, ...middleware: any[]): void;
put(path: RouterPath, fn: string): void;
put(path: RouterPath, ...middleware: any[]): void;

/**
* HTTP delete method
*/
delete(path: string, fn: string): void;
delete(path: string, ...middleware: any[]): void;
delete(path: RouterPath, fn: string): void;
delete(path: RouterPath, ...middleware: any[]): void;

/**
* restful router api
Expand Down

0 comments on commit 1a73720

Please sign in to comment.