Skip to content

next dev and next typegen generate different outputs for validator.ts #83063

@sm17p

Description

@sm17p

For me, I don't have the rootDir set butnext typegen and next dev generates different output for validators.ts.

I have a frontend directory where my next code resides. I'm runnning both of these commands from my project's root.

`next typegen frontend`` - This one is correct

Image

next dev frontend - This one is incorrect

Image

My tsconfig - frontend/tsconfig.json

{
  "compilerOptions": {
    "noEmit": true,
    "moduleResolution": "bundler",
    "target": "es2024",
    "lib": ["dom", "dom.iterable", "es2024"],
    "module": "esnext",
    "strict": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noFallthroughCasesInSwitch": true,
    "noImplicitOverride": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "forceConsistentCasingInFileNames": true,
    "plugins": [{ "name": "next" }],
    "paths": {
      "@/*": ["./*"]
    },
    "resolveJsonModule": true,
    "verbatimModuleSyntax": true,
    "jsx": "preserve",
    "skipLibCheck": true,
    "incremental": true,
    "esModuleInterop": true,
    "allowJs": true,
    "exactOptionalPropertyTypes": true,
    "types": []
  },
  "include": [
    "next-env.d.ts",
    "app/**/page.tsx",
    "app/**/error.tsx",
    "app/**/not-found.tsx",
    "app/**/layout.tsx",
    "app/**/route.ts",
    "trpc/**/*.ts",
    ".next/types/**/*.ts",
    "types/*.d.ts",
    "middleware.ts"
  ],
  "exclude": ["node_modules"]
}

Originally posted by @sm17p in #82877

Metadata

Metadata

Assignees

Labels

TypeScriptRelated to types with Next.js.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions