From 2d03c79a1842846c4caf2f3b971a5bae5fc9f24d Mon Sep 17 00:00:00 2001 From: SoraYama Date: Thu, 22 Feb 2018 12:09:26 +0800 Subject: [PATCH] chore: add urllib declaration support in index.d.ts (#2117) --- index.d.ts | 5 +++-- package.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 45c6b91ea4..84df0d45d6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,6 +1,7 @@ import * as accepts from 'accepts'; import * as KoaApplication from 'koa'; import * as KoaRouter from 'koa-router'; +import { RequestOptions } from 'urllib'; import { Readable } from 'stream'; /** * BaseContextClass is a base class that can be extended, @@ -470,7 +471,7 @@ declare interface EggApplication extends KoaApplication { // tslint:disable-line * Keep the same api with httpclient.request(url, args). * See https://github.com/node-modules/urllib#api-doc for more details. */ - curl(url: string, opt: any): Promise; + curl(url: string, opt: RequestOptions): Promise; /** * Get logger by name, it's equal to app.loggers['name'], but you can extend it with your own logical @@ -732,7 +733,7 @@ export interface Context extends KoaApplication.Context { * Keep the same api with httpclient.request(url, args). * See https://github.com/node-modules/urllib#api-doc for more details. */ - curl(url: string, opt: any): Promise; + curl(url: string, opt: RequestOptions): Promise; /** * Get logger by name, it's equal to app.loggers['name'], but you can extend it with your own logical diff --git a/package.json b/package.json index f55016a6b4..5764ed650b 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@types/accepts": "^1.3.3", "@types/koa": "^2.0.40", "@types/koa-router": "^7.0.25", + "@types/urllib": "^2.25.0", "accepts": "^1.3.4", "agentkeepalive": "^3.3.0", "cluster-client": "^1.7.1",