Skip to content

Commit 52cb73d

Browse files
committed
Fixed type usage
1 parent d6c8f55 commit 52cb73d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/nextjs-cache-handler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "git",
1111
"url": "git+https://github.com/fortedigital/nextjs-cache-handler.git"
1212
},
13-
"version": "1.3.0-canary1",
13+
"version": "1.3.0-canary3",
1414
"type": "module",
1515
"license": "MIT",
1616
"description": "Next.js cache handlers",

packages/nextjs-cache-handler/src/instrumentation/register-initial-cache.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { CachedFetchValue } from "next/dist/server/response-cache";
1010
import type { OutgoingHttpHeaders } from "http";
1111
import { getTagsFromHeaders } from "./helpers/getTagsFromHeaders";
1212

13+
type CacheHandlerType = typeof import('../handlers/next-15-cache-handler').Next15CacheHandler;
14+
1315
type NextRouteMetadata = {
1416
status: number | undefined;
1517
headers: OutgoingHttpHeaders | undefined;
@@ -80,7 +82,7 @@ export type RegisterInitialCacheOptions = {
8082
*
8183
*/
8284
export async function registerInitialCache(
83-
CacheHandler: CacheHandler,
85+
CacheHandler: CacheHandlerType,
8486
options: RegisterInitialCacheOptions = {},
8587
) {
8688
const debug = typeof process.env.NEXT_PRIVATE_DEBUG_CACHE !== "undefined";
@@ -125,11 +127,11 @@ export async function registerInitialCache(
125127
dev: process.env.NODE_ENV === "development",
126128
};
127129

128-
let cacheHandler: CacheHandler;
130+
let cacheHandler: InstanceType<CacheHandlerType>;
129131

130132
try {
131-
cacheHandler = new Next15CacheHandler(
132-
context as ConstructorParameters<typeof Next15CacheHandler>[0],
133+
cacheHandler = new CacheHandler(
134+
context as ConstructorParameters<typeof CacheHandler>[0],
133135
);
134136
} catch (error) {
135137
if (debug) {

0 commit comments

Comments
 (0)