Skip to content

Commit

Permalink
Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Ageev committed Mar 26, 2024
1 parent 43d3325 commit 90d4f6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ function parseParam<T>(queryParam: unknown, parserLogic: (param: string, res: an
}

export const Paginate = createParamDecorator((_data: unknown, ctx: ExecutionContext): PaginateQuery => {
const isRpc = (ctx as ExecutionContext & { contextType: string })?.contextType === 'rpc'
const request: ExpressRequest | FastifyRequest = ctx.switchToHttp().getRequest()
const query = (ctx.contextType === 'rpc' ? request : request.query) as Record<string, unknown>
const query = (isRpc ? request : request.query) as Record<string, unknown>

// Determine if Express or Fastify to rebuild the original url and reduce down to protocol, host and base url
let originalUrl: string
Expand Down

0 comments on commit 90d4f6d

Please sign in to comment.