From ded108693b02df1041b2d00a052ca63071ee1717 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Mon, 25 Mar 2019 12:28:10 -0400 Subject: [PATCH] [cacheable-request] Include type alias for cache adapter (#34155) * [cacheable-request] Include type alias for cache adapter This allows easily declaring a parameter that will be passed into the constructor. Ref https://github.com/sindresorhus/got/pull/760#discussion_r268277506 * Fix missing semicolon * Move StorageAdapter into namespace --- types/cacheable-request/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/cacheable-request/index.d.ts b/types/cacheable-request/index.d.ts index 98d858d3f6..16e778274a 100644 --- a/types/cacheable-request/index.d.ts +++ b/types/cacheable-request/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for cacheable-request 6.0 // Project: https://github.com/lukechilds/cacheable-request#readme // Definitions by: BendingBender +// Paul Melnikow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -20,7 +21,7 @@ declare const CacheableRequest: CacheableRequest; type RequestFn = typeof request; interface CacheableRequest { - new (requestFn: RequestFn, storageAdapter?: string | Store): ( + new (requestFn: RequestFn, storageAdapter?: string | CacheableRequest.StorageAdapter): ( opts: string | URL | (RequestOptions & CacheSemanticsOptions), cb?: (response: ServerResponse | ResponseLike) => void ) => CacheableRequest.Emitter; @@ -30,6 +31,8 @@ interface CacheableRequest { } declare namespace CacheableRequest { + type StorageAdapter = Store; + interface Options { /** * If the cache should be used. Setting this to `false` will completely bypass the cache for the current request.