-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
Link to the code that reproduces this issue
https://github.com/blessibles/blessibles-cursor
To Reproduce
- Create a dynamic route at src/app/admin/user/[userId]/page.tsx
- Run npm run build
- Observe the type error referencing .next/types/app/admin/user/[userId]/page.ts
Current vs. Expected behavior
When building a dynamic route at src/app/admin/user/[userId]/page.tsx, the build fails with a type error:
Type '{ params: { userId: string; }; }' is missing the following properties from type 'Promise': then, catch, finally, [Symbol.toStringTag]
The generated .next/types/app/admin/user/[userId]/page.ts expects params to be a Promise, which is not correct for a dynamic route page.
This error persists even after:
- Removing all type annotations and using only inline types
- Deleting .next, node_modules, and lock files
- Creating a brand new Next.js project and copying only the source files
- Renaming the dynamic route folder
- Deleting stale type files in .next/types
The error always references the same generated type file, even after all caches are cleared and the route is renamed.
Expected:
The build should succeed, and the generated types should expect params to be an object, not a Promise, for a dynamic route page.
Provide environment information
Operating system: Windows 11
App dir: admin
Dynamic route: src/app/admin/user/[userId]/page.tsx
Node.js: v22.16.0
Next.js: 15.3.3
Typescript: 5.8.3Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
This error is reproducible in a fresh Next.js project with only the relevant files copied over. All troubleshooting steps from the official docs and community have been exhausted.
With the help of an expert assistant, I have systematically tried all of the following:
-
Removed all explicit type annotations from the page and used only inline types.
-
Deleted all build artifacts and caches: .next, .next/types, node_modules, package-lock.json.
-
Performed a full clean install of all dependencies.
-
Renamed the dynamic route folder (e.g., from [userId] to [uid] and [userPageId]).
-
Deleted stale type files in .next/types.
-
Moved the page to a new dynamic route in a fresh folder.
-
Created a brand new Next.js project using npx create-next-app, copied only the source files and configs, and tried building there.
-
Tried disabling type checking with // @ts-nocheck and NEXT_IGNORE_TYPE_ERRORS=true.
-
Checked for custom or global type definitions that could interfere (none found).
-
Confirmed all versions of Next.js and TypeScript are compatible and up to date.
**The attached ZIP file contains:
- src/app/admin/user/[userId]/page.tsx
- .next/types/app/admin/user/[userId]/page.ts
- package.json
- tsconfig.json**
The error persists in all cases, and always references the same generated type file, even after all caches are cleared and the route is renamed.