Next.js Discord

Discord Forum

can't find module "types/nav"

Answered
QBit posted this in #help-forum
Open in Discord
I already have types/nav in my next.js app then why error? You can see in image.
Answered by joulev
then it is @/types/nav not types/nav
View full answer

11 Replies

how to solve it?
{
  "compilerOptions": {
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}
then it is @/types/nav not types/nav
Answer
also you probably need to add "baseUrl": "." in compilerOptions
why to add baseUrl?
does @/types/nav work without baseurl? ive seen people getting it to work without, but also people who need baseurl
yeah, @/types/nav working without baseurl (not showing red highlight)
yes then good
cool
thanks!!