I'm using next-connect with @sentry/nextjs, and the withApiAuthRequired() helper in that package takes an argument of NextApiHandler as defined in NextJS itself. However, when using next-connect, the NextConnect type isn't compatible with NextApiHandler, probably because Req and Res can be any type - so I'm forced to cast it to make TypeScript not complain. Would be nice if the types lined up so that wouldn't need a cast. Would be nice if I didn't need to.
I'm using
next-connect
with@sentry/nextjs
, and thewithApiAuthRequired()
helper in that package takes an argument ofNextApiHandler
as defined in NextJS itself. However, when usingnext-connect
, theNextConnect
type isn't compatible withNextApiHandler
, probably becauseReq
andRes
can be any type - so I'm forced to cast it to make TypeScript not complain. Would be nice if the types lined up so that wouldn't need a cast. Would be nice if I didn't need to.