nextjs-routes: Typescript Complaint: Expected 0 type arguments, but got 1

Hi, I am using the nextjs-routes@0.1.0 with the withRoutes configuration but I am not sure it’s working as expected. I am seeing the following error image

I also cannot see the nextjs-routes nextjs-routes.d.ts types or any addition to my tsconfig.json.

Any ideas what am I missing?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (18 by maintainers)

Most upvoted comments

I’m seeing Could not find a Next.js pages directory. issue as well with a Nx generated Next.js, which doesn’t include package.json file in the Next.js folder. I think it would be most straightforward to simply change the API to require('nextjs-routes/config')(__dirname)

Ok, I moved all the next and yarn stuff into the frontend folder and it works

We could consider resolving the pages directory relative to the the next.config.js instead of package.json, which isn’t a big lift after the deprecation of the cli invocation. I’m hesitant to make this a dedication configuration option, because we should be able to find routes identical to next. What do you think @MariaSolOs ?

Cool I will try to move everything down just to check

No I think that’s the problem the yarn and next.config life in the root and the rest is in the front-end folder but I’m sure if I just move everything there it will work. Just wanted to note that maybe it’s not the most uncommon case?

Hi of course. Here is my next.config.js

const withRoutes = require('nextjs-routes/config')()

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  sassOptions: {
    includePaths: ['./styles'],
  },
}

module.exports = withRoutes(nextConfig)

and yes I am running next dev