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.64k stars 65 forks source link

docs: update router return statement to include type casting for next 14 app router #243

Open OgDev-01 opened 7 months ago

OgDev-01 commented 7 months ago

Fixes https://github.com/hoangvvo/next-connect/issues/241

This PR updates the readme to include a life saving section that fixes an error with h Next.js 14 app router in production/preview using typescript

Before

image

After

image

changeset-bot[bot] commented 7 months ago

⚠️ No Changeset found

Latest commit: 06bbeb1e7f87e2abd05429e0f78a5eb91799a831

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (a56a9f9) 100.00% compared to head (06bbeb1) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #243 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 5 5 Lines 436 436 Branches 60 60 ========================================= Hits 436 436 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

OgDev-01 commented 7 months ago

Hello @hoangvvo, Thanks for putting up this wonderful library 💯 . It has been a lifesaver for me since i started writing server code in nextjs.

I made a small update to the readme for a current issue we have with NextJS14 app router. This would prevent new/existing users who use nextjs 14 app router from facing issues with return type errors for the route handlers export.

Would you mind taking a look at this when you have the time?

Thanks 🤝