Skip to content

Commit 95c727a

Browse files
authored
🤖 Merge PR DefinitelyTyped#74498 cacache: add missing options argument for cacache.get.info by @hexchain
1 parent cdadc54 commit 95c727a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎types/cacache/cacache-tests.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ cacache.get.stream.byDigest(cachePath, "sha512-SoMeDIGest+64==").pipe(fs.createW
3232

3333
cacache.get.info(cachePath, "my-thing").then(() => {});
3434

35+
cacache.get.info(cachePath, "my-thing", { memoize: true }).then(() => {});
36+
37+
cacache.get.info(cachePath, "my-thing", { memoize: new Map() }).then(() => {});
38+
3539
cacache.get.hasContent(cachePath, "sha521-NOT+IN/CACHE==").then((res) => {
3640
res; // $ExpectType HasContentObject | false
3741
});

‎types/cacache/index.d.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export namespace get {
7979
size?: number | undefined;
8080
}
8181

82+
type InfoOptions = Pick<Options, "memoize">;
83+
8284
interface GetStreamEvents extends Minipass.Events<Buffer> {
8385
// eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
8486
integrity: [integrity: string];
@@ -116,7 +118,7 @@ export namespace get {
116118
* Looks up `key` in the cache index, returning information about the entry
117119
* if one exists.
118120
*/
119-
function info(cachePath: string, key: string): Promise<CacheObject>;
121+
function info(cachePath: string, key: string, opts?: InfoOptions): Promise<CacheObject | null>;
120122

121123
/**
122124
* Returns a Readable Stream of the cached data identified by `key`.

0 commit comments

Comments
 (0)