hoangvvo / next-connect

The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2
https://www.npmjs.com/package/next-connect
MIT License
1.63k stars 65 forks source link

Error typescript with the change on #128 #132

Closed Julienng closed 2 years ago

Julienng commented 3 years ago

Hi,

I just upgrade the next-connect on 0.10.1 and the change :

function NextConnect<U,V>(req: U, res: V): Promise<void>;

into the NextConnect interface make typescript infer any on req & res on .use function.

Example screenshot before / after

before_128 after_128

I don't know enough about TS inference here to make a pull request 😕.

hoangvvo commented 3 years ago

image

That is very strange. I used it and personally had no problem. However though, I did notice this happens from time to time (even on older version) but not sure the cause.

Julienng commented 3 years ago

Yes, this is very strange 🤔. Ts is weird sometimes! Thanks anyway, your lib is awesome 👍!