#Type error: Type 'PageParams' does not satisfy the constraint 'PageProps'.

1 messages · Page 1 of 1 (latest)

dusty dagger
#

Error:

src/app/[...slug]/page.tsx
Type error: Type 'PageParams' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ slug?: string | string[]; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]

See attached files for my code. Can someone help me out?

thick wharfBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

agile drift
#
interface PageParams {
-  params: { slug?: string[] | string }
+  params: Promise<{ slug?: string[] | string }>
-  searchParams: Record<string, string>
+  searchParams: Promise<Record<string, string>>
}
dusty dagger
agile drift
#

yea since they're now promise, you need to do await params

#

same with searchParams

#
props:PageParams

const params = await props.params
const searchParams = await props.searchParams

// Use these 2 variables now instead of props.