Created
February 22, 2023 00:48
-
-
Save akshitkrnagpal/573d1678812dc7a21a368179a13299f2 to your computer and use it in GitHub Desktop.
Improve typesafety of your next/router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NextRouter } from "next/router"; | |
declare module "next/router" { | |
export type Locale = "en" | "nl" | "de"; | |
export function useRouter(): Omit<NextRouter, "locale" | "locales"> & { | |
locale: Locale; | |
locales: Locale[]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment