Skip to content

Commit 4320d64

Browse files
committed
fix: typescript errors and accidental deletion
1 parent 69114ad commit 4320d64

File tree

1 file changed

+5
-6
lines changed
  • packages/runtime/src/templates/edge-shared

1 file changed

+5
-6
lines changed

packages/runtime/src/templates/edge-shared/utils.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ export interface FetchEventResult {
66
waitUntil: Promise<any>
77
}
88

9-
function normalizeDataUrl(redirect, url) {
9+
type NextDataTransform = <T>(data: T) => T
10+
11+
function normalizeDataUrl(redirect: string, url: string | URL) {
1012
const normalizedUrl = new URL(redirect, url)
1113

12-
if (
13-
normalizedUrl.pathname.startsWith('/_next/data/') &&
14-
normalizedUrl.pathname.endsWith('.json')
15-
) {
14+
if (normalizedUrl.pathname.startsWith('/_next/data/') && normalizedUrl.pathname.endsWith('.json')) {
1615
const paths = normalizedUrl.pathname
1716
.replace(/^\/_next\/data\//, '')
1817
.replace(/\.json$/, '')
@@ -22,7 +21,7 @@ function normalizeDataUrl(redirect, url) {
2221
normalizedUrl.pathname = paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/'
2322
}
2423

25-
return normalizedUrl.pathname + normalizedUrl.search;
24+
return normalizedUrl.pathname + normalizedUrl.search
2625
}
2726

2827
/**

0 commit comments

Comments
 (0)