Skip to content

Commit

Permalink
Fix type error from merge (#70481)
Browse files Browse the repository at this point in the history
x-ref: #70410
x-ref: #70435
  • Loading branch information
ijjk authored Sep 25, 2024
1 parent e2ae5e9 commit afb13c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/next/src/server/use-cache/use-cache-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function generateCacheEntry(
fn: any
): Promise<ReadableStream> {
const temporaryReferences = createServerTemporaryReferenceSet()
const [, args] = await decodeReply(encodedArguments, serverManifest, {
const [, args] = await decodeReply<any[]>(encodedArguments, serverManifest, {
temporaryReferences,
})

Expand Down Expand Up @@ -117,19 +117,17 @@ async function generateCacheEntry(
const reader = savedStream.getReader()
const erroringSavedStream = new ReadableStream({
pull(controller) {
return reader
.read()
.then(({ done, value }: { done: boolean; value: any }) => {
if (done) {
if (didError) {
controller.error(firstError)
} else {
controller.close()
}
return
return reader.read().then(({ done, value }) => {
if (done) {
if (didError) {
controller.error(firstError)
} else {
controller.close()
}
controller.enqueue(value)
})
return
}
controller.enqueue(value)
})
},
cancel(reason: any) {
reader.cancel(reason)
Expand Down
4 changes: 4 additions & 0 deletions packages/next/types/$$compiled.internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ declare module 'react-server-dom-webpack/server.edge' {
}
},
options?: {
temporaryReferences?: string
environmentName?: string
filterStackFrame?: (url: string, functionName: string) => boolean
onError?: (error: unknown) => void
onPostpone?: (reason: string) => void
signal?: AbortSignal
}
): ReadableStream<Uint8Array>

export function createTemporaryReferenceSet(...args: any[]): any

type ServerManifest = {}

export function decodeReply<T>(
Expand Down

0 comments on commit afb13c2

Please sign in to comment.