From 0e267a89f1b7c319ffefc772d55dedc557c23d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez?= Date: Wed, 7 Sep 2016 04:23:52 -0600 Subject: [PATCH] Use same type for next function in middleware as koa main project (#10785) --- koa-router/koa-router-tests.ts | 4 ++-- koa-router/koa-router.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koa-router/koa-router-tests.ts b/koa-router/koa-router-tests.ts index 36d3e6c1c8..d2bae290a4 100644 --- a/koa-router/koa-router-tests.ts +++ b/koa-router/koa-router-tests.ts @@ -23,11 +23,11 @@ router .put('/users/:id', function (ctx, next) { ctx.body = ctx.params.id; }) - .del('/users/:id', function (ctx, next) { + .del('/users/:id', function () { // ... }); -router.get('user', '/users/:id', function (ctx, next) { +router.get('user', '/users/:id', function (ctx) { ctx.body = "sdsd"; }); diff --git a/koa-router/koa-router.d.ts b/koa-router/koa-router.d.ts index a6e8909e83..81a961b93a 100644 --- a/koa-router/koa-router.d.ts +++ b/koa-router/koa-router.d.ts @@ -49,11 +49,11 @@ declare module "koa-router" { } export interface IMiddleware { - (ctx: Router.IRouterContext, next?: () => any): any; + (ctx: Router.IRouterContext, next: () => Promise): any; } export interface IParamMiddleware { - (param: string, ctx: Router.IRouterContext, next?: () => any): any; + (param: string, ctx: Router.IRouterContext, next: () => Promise): any; } export interface IRouterAllowedMethodsOptions {