tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
580 stars 21 forks source link

bug: useParams return type of RouteLiteral is being resolved as any #202

Closed aqos156 closed 1 month ago

aqos156 commented 1 month ago

Describe the bug When usePathname is used within the codebase the return type RouteLiteral is being resolved to any.

image

However, everywhere else (that I have checked) the RouteLiteral is being resolved correctly.

image

Workaround

I have disabled generating types in production builds and manually removed the usePathname type override from nextjs-routes.d.ts.

Context (please complete the following information):

tatethurston commented 1 month ago

@aqos156 Thanks for reporting this bug -- that was quite the oversight on my end. I've updated the specs to catch this and published v2.2.3 with the fix.