From 9eaf1275f4ec80a17a27084f40f66064af3672b8 Mon Sep 17 00:00:00 2001 From: wxqqh Date: Thu, 18 Feb 2016 19:42:45 +0800 Subject: [PATCH] Add open interfaces Just link https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/express/express.d.ts#L16 --- koa/koa-1.1.2.d.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/koa/koa-1.1.2.d.ts b/koa/koa-1.1.2.d.ts index 2520f8faeb..abcb471be3 100644 --- a/koa/koa-1.1.2.d.ts +++ b/koa/koa-1.1.2.d.ts @@ -13,13 +13,22 @@ /// /// +declare module Koa { + + // These open interfaces may be extended in an application-specific manner via declaration merging. + // See for example method-override.d.ts (https://github.com/borisyankov/DefinitelyTyped/blob/master/method-override/method-override.d.ts) + export interface Request { } + export interface Response { } + export interface Application { } +} + declare module "koa" { import * as net from 'net'; import * as http from 'http'; import * as events from 'events'; import * as Cookies from 'cookies'; - interface IRequest { + interface IRequest extends Koa.Request { /** * Return request header. * @@ -272,7 +281,7 @@ declare module "koa" { get(field: string): string; } - interface IResponse { + interface IResponse extends Koa.Response{ /** * Get/Set response status code. */ @@ -543,7 +552,7 @@ declare module "koa" { state: any; } - interface Application extends events.EventEmitter { + interface Application extends events.EventEmitter , Koa.Application{ env: string; subdomainOffset: number; middleware: any[]; @@ -560,6 +569,7 @@ declare module "koa" { listen(port: number, hostname?: string, callback?: Function): http.Server; listen(path: string, callback?: Function): http.Server; listen(handle: any, listeningListener?: Function): http.Server; + listen(): http.Server; /** * Return JSON representation. * We only bother showing settings. @@ -602,4 +612,4 @@ declare module "koa" { var koa: KoaStatic; export = koa; -} \ No newline at end of file +}