I am using next, and I find the the type of NextApiResponse to be problematic in that it does not require a generic in order to correctly type the json method.
I am trying to overload the module so as to require a generic:
declare module 'next' {
import {Send} from 'express'
import {NextApiRequest} from 'next'
export declare type NextApiResponse<T> = {
json: Send<T>
}
export declare type NextApiRequest = NextApiRequest
}
I use it as such
res: NextApiResponse<{t: 1}>,
But I still see any as the inferred type of json.