Skip to content

Commit

Permalink
refactor(router): replace any generic type param defaults with `unk…
Browse files Browse the repository at this point in the history
…nown`
  • Loading branch information
Lordfirespeed committed Aug 10, 2024
1 parent 94b096f commit 1536914
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/router/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

import { isString, isStringArray } from './type-guards'

export type NextFunction = (err?: any) => void
export type NextFunction = (err?: unknown) => void

export type SyncHandler<Request = any, Response = any> = (req: Request, res: Response, next: NextFunction) => void
export type SyncHandler<Request = unknown, Response = unknown> = (
req: Request,
res: Response,
next: NextFunction
) => void

export type AsyncHandler<Request = any, Response = any> = (
export type AsyncHandler<Request = unknown, Response = unknown> = (
req: Request,
res: Response,
next: NextFunction
) => Promise<void>

export type Handler<Request = any, Response = any> = AsyncHandler<Request, Response> | SyncHandler<Request, Response>
export type Handler<Request = unknown, Response = unknown> =
| AsyncHandler<Request, Response>
| SyncHandler<Request, Response>

const METHODS = [
'ACL',
Expand Down

0 comments on commit 1536914

Please sign in to comment.