I am struggling with Type error on nextjs

When I was ready to deploy, I wrote npm run build in my nextjs application, I got this error.

The problem is that I don’t know what it is or where to look, I leave the link to my repository if you want to take a look, thanks in advance

Type error: Type ‘{ tag: “POST”; param_position: “first”; param_type: { json(): { name: any; email: any; password: any; } | PromiseLike<{ name: any; email: any; password: any; }>; method: string; body: { …; }; }; }’ does not satisfy the constraint ‘ParamCheck<NextRequest | Request>’.
Types of property ‘param_type’ are incompatible.
Type ‘{ json(): { name: any; email: any; password: any; } | PromiseLike<{ name: any; email: any; password: any; }>; method: string; body: { name: any; email: any; password: any; }; }’ is not assignable to type ‘NextRequest | Request’.
Type ‘{ json(): { name: any; email: any; password: any; } | PromiseLike<{ name: any; email: any; password: any; }>; method: string; body: { name: any;
email: any; password: any; }; }’ is missing the following properties from type ‘Request’: cache, credentials, destination, headers, and 14 more.

148 | Diff<
149 | ParamCheck<Request | NextRequest>,

150 | {
| ^
151 | tag: ‘POST’
152 | param_position: ‘first’
153 | param_type: FirstArg<MaybeField<TEntry, ‘POST’>>

Can’t you just use (req: Request) for the route handler parameter?

That works, thanks, but I have another similar problem. Can I put it here or do I need to create another post?

If it is for the same project it would be best if you asked it here.

I got this error.

./src/app/api/auth/[…nextauth]/route.ts:10:11
Type error: Type ‘({ user, account }: { user: User | AdapterUser; account: Account; profile?: Profile; email?: { verificationRequest?: boolean; }; credentials?: Record<string, CredentialInput>; }) => Promise<…>’ is not assignable to type ‘(params: { user: User | AdapterUser; account: Account; profile?: Profile; email?: { verificationRequest?: boolean; }; credentials?: Record<string, CredentialInput>; }) => Awaitable<…>’.
Type ‘Promise<false | User>’ is not assignable to type ‘Awaitable<string | boolean>’.
Type ‘Promise<false | User>’ is not assignable to type ‘PromiseLike<string | boolean>’.
Types of property ‘then’ are incompatible.
Type ‘<TResult1 = false | User, TResult2 = never>(onfulfilled?: (value: false | User) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike<…>) => Promise<…>’ is not assignable to type ‘<TResult1 = string | boolean, TResult2 = never>(onfulfilled?: (value: string | boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike<…>) => PromiseLike<…>’.
Types of parameters ‘onfulfilled’ and ‘onfulfilled’ are incompatible.
Types of parameters ‘value’ and ‘value’ are incompatible.
Type ‘false | User’ is not assignable to type ‘string | boolean’.
Type ‘User’ is not assignable to type ‘string | boolean’.

8 | const handler = NextAuth({
9 | callbacks: {

10 | async signIn({ user, account }) {
| ^
11 | console.log(account?.provider);
12 | if (account?.provider === “google”) {
13 | const { email } = user;

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.