v0.0.15
What's Changed
- nextjs-routes no longer adds types to the global type namespace. Previously,
Route
was available globally. Now, it must be imported:
import type { Route } from "nextjs-routes";
- query from
useRouter
is now correctly typed asstring | undefined
instead ofstring
. If you know the current route, you can supply a type argument to narrow required parameters to string, eg:
// if you have a page /foos/[foo].ts
const router = useRouter<"/foos/[foo]">();
// foo will be typed as a string, because the foo query parameter is required and thus will always be present.
const { foo } = router.query;
Full Changelog: v0.0.14...v0.0.15