reactjsnext.jsnext-intl

next-intl routing.ts giving TS2554: Expected 0 arguments, but got 1


Keep getting "TS2554: Expected  0  arguments, but got  1" when using next-intl with NextJS 14 and TypeScript 5. I'm following the example in the docs and can't seem to get rid of this warning.

import { createNavigation } from "next-intl/navigation";
import { defineRouting } from "next-intl/routing";

export const routing = defineRouting({
  locales: ["en-US", "fr-CA", "nl-NL"],
  defaultLocale: "en-US",
});

export type Pathnames = keyof typeof routing.pathnames;
export type Locale = (typeof routing.locales)[number];

export const { Link, getPathname, redirect, usePathname, useRouter } =
  createNavigation(routing);

enter image description here


Solution

  • I faced this issue and was able to resolve it by updating my typescript version; I'm now currently using "typescript": "^5.6.3". Try that and see if it works. Good luck!