Compilation Error
Unanswered
shadow posted this in #help-forum
shadowOP
Hey, im having this compilation error and i dont know why because it never appeared
$ npm run prod
> prod
> next build && next start
▲ Next.js 15.0.0
- Environments: .env
Creating an optimized production build ...
✓ Compiled successfully
Linting and checking validity of types .Failed to compile.
.next/types/app/snippets/edit/[snippetId]/page.ts:34:29
Type error: Type '{ params: { snippetId: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ snippetId: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
32 |
33 | // Check the prop type of the entry function
> 34 | checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>()
| ^
35 |
36 | // Check the arguments and return type of the generateMetadata function
37 | if ('generateMetadata' in entry) {
1 Reply
shadowOP
i think the problem is coming from this file but i am not sure.
import EditSnippet from '@/components/Snippets/EditSnippet/EditSnippet';
import SnippetNotFound from '@/components/Snippets/SnippetNotFound';
import { createClient } from '@/utils/supabase/server';
import React from 'react';
export default async function EditSnippetPage({ params }: { params: { snippetId: string } }) {
const { snippetId } = await params;// i dont know if i should use await here but tried without await and the same error appeared
const supabase = await createClient();
const { data: snippets, error } = await supabase.from("snippets").select("*, author:profiles(id)").eq("id", snippetId);
const { data: { user }, error: userError } = await supabase.auth.getUser();
let isAuthor = false;
if (snippets) {
isAuthor = user?.id === snippets[0].author.id;
}
return (
<div>
{snippets && snippets.length > 0 && isAuthor ? (
<EditSnippet snippet={snippets[0]} />
) : (
<div className='my-32'>
<SnippetNotFound />
</div>
)}
</div>
);
}