From 92249d14aea411d89c3dcab37253efcaab5e9ead Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Mon, 12 Jan 2015 15:28:31 +1300 Subject: [PATCH] Move interfaces into exported module --- rest/rest.d.ts | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/rest/rest.d.ts b/rest/rest.d.ts index 37ecc4675..d8126b72d 100644 --- a/rest/rest.d.ts +++ b/rest/rest.d.ts @@ -71,27 +71,29 @@ declare module "rest/interceptor" { import when = require("when"); import rest = require("rest"); - // TODO: These two configs should be merged to use union output types. + function interceptor(config: interceptor.Config): rest.Interceptor; + function interceptor(config: interceptor.PromiseConfig): rest.Interceptor; - interface Config { - init?: (config: any) => any; - request?: (request: rest.Request, config: any, meta: rest.Meta) => rest.Request; - response?: (response: rest.Response, config: any, meta: rest.Meta) => rest.Response; - success?: (response: rest.Response, config: any, meta: rest.Meta) => rest.Response; - error?: (response: rest.Response, config: any, meta: rest.Meta) => rest.Response; + module interceptor { + // TODO: These two configs should be merged to use union output types. + + interface Config { + init?: (config: any) => any; + request?: (request: rest.Request, config: any, meta: rest.Meta) => rest.Request; + response?: (response: rest.Response, config: any, meta: rest.Meta) => rest.Response; + success?: (response: rest.Response, config: any, meta: rest.Meta) => rest.Response; + error?: (response: rest.Response, config: any, meta: rest.Meta) => rest.Response; + } + + interface PromiseConfig { + init?: (config: any) => any; + request?: (request: rest.Request, config: any, meta: rest.Meta) => when.Promise; + response?: (response: rest.Response, config: any, meta: rest.Meta) => when.Promise; + success?: (response: rest.Response, config: any, meta: rest.Meta) => when.Promise; + error?: (response: rest.Response, config: any, meta: rest.Meta) => when.Promise; + } } - interface PromiseConfig { - init?: (config: any) => any; - request?: (request: rest.Request, config: any, meta: rest.Meta) => when.Promise; - response?: (response: rest.Response, config: any, meta: rest.Meta) => when.Promise; - success?: (response: rest.Response, config: any, meta: rest.Meta) => when.Promise; - error?: (response: rest.Response, config: any, meta: rest.Meta) => when.Promise; - } - - function interceptor(config: Config): rest.Interceptor; - function interceptor(config: PromiseConfig): rest.Interceptor; - export = interceptor; }