Skip to content

Commit

Permalink
Reuse RenderWorker type (vercel#53782)
Browse files Browse the repository at this point in the history
Found that this type was duplicated. This just reuses the existing definition.
  • Loading branch information
timneutkens authored Aug 10, 2023
1 parent 89be8c4 commit d4ff236
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/next/src/server/lib/server-ipc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import crypto from 'crypto'
import isError from '../../../lib/is-error'
import { genRenderExecArgv } from '../worker-utils'
import { deserializeErr } from './request-utils'
import { RenderWorker } from '../router-server'

// we can't use process.send as jest-worker relies on
// it already and can cause unexpected message errors
Expand Down Expand Up @@ -87,7 +88,7 @@ export const createWorker = async (
isNodeDebugging: boolean | 'brk' | undefined,
type: 'pages' | 'app',
nextConfig: NextConfigComplete
) => {
): Promise<RenderWorker> => {
const { initialEnv } = require('@next/env') as typeof import('@next/env')
const useServerActions = !!nextConfig.experimental.serverActions
const { Worker } =
Expand Down Expand Up @@ -133,13 +134,7 @@ export const createWorker = async (
'clearModuleContext',
'propagateServerField',
],
}) as any as InstanceType<typeof Worker> & {
initialize: typeof import('../render-server').initialize
deleteCache: typeof import('../render-server').deleteCache
deleteAppClientCache: typeof import('../render-server').deleteAppClientCache
clearModuleContext: typeof import('../render-server').clearModuleContext
propagateServerField: typeof import('../render-server').propagateServerField
}
}) as any as RenderWorker

worker.getStderr().pipe(process.stderr)
worker.getStdout().pipe(process.stdout)
Expand Down

0 comments on commit d4ff236

Please sign in to comment.