Skip to content

Commit a202f56

Browse files
committed
fix(nest): avoid confusion between Fetch Response and Express Response types
1 parent 25cfa7c commit a202f56

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/nest/src/implement.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { AnyProcedureContract, RouterContract } from '@orpc/contract'
33
import type { ContractedRouter, DefaultInitialContext } from '@orpc/server'
44
import type { Promisable } from '@orpc/shared'
55
import type { StandardBodyHint } from '@standardserver/core'
6-
import type { Request, Response } from 'express'
6+
import type { Request as ExpressRequest, Response as ExpressResponse } from 'express'
77
import type { FastifyReply, FastifyRequest } from 'fastify'
88
import type { Observable } from 'rxjs'
99
import type { ORPCModuleConfig } from './module'
@@ -106,7 +106,7 @@ export class ImplementInterceptor implements NestInterceptor {
106106
this.httpAdapterHost = httpAdapterHost
107107

108108
this.codec = new OpenAPIHandlerCodecCore(this.config)
109-
this.toStandardLazyRequest = this.config.toStandardLazyRequest ?? ((req: Request | FastifyRequest, res: Response | FastifyReply) => {
109+
this.toStandardLazyRequest = this.config.toStandardLazyRequest ?? ((req: ExpressRequest | FastifyRequest, res: ExpressResponse | FastifyReply) => {
110110
const standardRequest = toStandardLazyRequest(
111111
'raw' in req ? req.raw : req,
112112
'raw' in res ? res.raw : res,
@@ -132,8 +132,8 @@ export class ImplementInterceptor implements NestInterceptor {
132132
`)
133133
}
134134

135-
const req: Request | FastifyRequest = ctx.switchToHttp().getRequest()
136-
const res: Response | FastifyReply = ctx.switchToHttp().getResponse()
135+
const req: ExpressRequest | FastifyRequest = ctx.switchToHttp().getRequest()
136+
const res: ExpressResponse | FastifyReply = ctx.switchToHttp().getResponse()
137137

138138
const standardRequest = this.toStandardLazyRequest(req, res)
139139

0 commit comments

Comments
 (0)