Skip to content

v0.0.15

Compare
Choose a tag to compare
@tatethurston tatethurston released this 07 Jul 21:20
· 138 commits to main since this release
7bf7868

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 as string | undefined instead of string. 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