Skip to content

Commit 0078428

Browse files
add CachedFetchValue overrides type
1 parent f9b9ae9 commit 0078428

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/open-next/src/types/overrides.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,29 @@ export type CachedFile =
5454
meta?: Meta;
5555
};
5656

57-
export type FetchCache = Object;
57+
// type taken from: https://github.com/vercel/next.js/blob/9a1cd356/packages/next/src/server/response-cache/types.ts#L26-L38
58+
export type CachedFetchValue = {
59+
kind: "FETCH";
60+
data: {
61+
headers: { [k: string]: string };
62+
body: string;
63+
url: string;
64+
status?: number;
65+
// field used by older versions of Next.js (see: https://github.com/vercel/next.js/blob/fda1ecc/packages/next/src/server/response-cache/types.ts#L23)
66+
tags?: string[];
67+
};
68+
// tags are only present with file-system-cache
69+
// fetch cache stores tags outside of cache entry
70+
tags?: string[];
71+
};
5872

5973
export type WithLastModified<T> = {
6074
lastModified?: number;
6175
value?: T;
6276
};
6377

6478
export type CacheValue<IsFetch extends boolean> = (IsFetch extends true
65-
? FetchCache
79+
? Partial<CachedFetchValue>
6680
: CachedFile) & { revalidate?: number | false };
6781

6882
export type IncrementalCache = {

0 commit comments

Comments
 (0)