mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-03-31 10:44:33 +00:00
[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
This commit is contained in:
committed by
Sheetal Nandi
parent
f51241ad20
commit
ded108693b
5
types/cacheable-request/index.d.ts
vendored
5
types/cacheable-request/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for cacheable-request 6.0
|
||||
// Project: https://github.com/lukechilds/cacheable-request#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Paul Melnikow <https://github.com/paulmelnikow>
|
||||
// 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<any>): (
|
||||
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<any>;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* If the cache should be used. Setting this to `false` will completely bypass the cache for the current request.
|
||||
|
||||
Reference in New Issue
Block a user