Error when building async params
Unanswered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
anyone have error when build?
error
app/(member)/member/[memberid]/[name]/@funfact/page.tsx
Type error: Type '{ params: { memberid: string; name: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ memberid: string; name: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
the code inside a dynamic route [memberid]/[name]/page.tsx
export default async function Page({
params,
}: {
params: { memberid: string; name: string };
}) {
const {memberid} = await params
const funfactResponse = await GetFunfact(memberid);
due to async next 15 i though we need to async the params
error
app/(member)/member/[memberid]/[name]/@funfact/page.tsx
Type error: Type '{ params: { memberid: string; name: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ memberid: string; name: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
the code inside a dynamic route [memberid]/[name]/page.tsx
export default async function Page({
params,
}: {
params: { memberid: string; name: string };
}) {
const {memberid} = await params
const funfactResponse = await GetFunfact(memberid);
due to async next 15 i though we need to async the params
10 Replies
Saltwater CrocodileOP
@Saltwater Crocodile it this related to
https://stackoverflow.com/questions/79145063/params-should-be-awaited-nextjs15
not really no, your type is just wrong
change the type then your code should be good already
Saltwater CrocodileOP
that is weird even though i use your code which a promise still an error
app/(member)/member/[memberid]/[name]/@profile/page.tsx
Type error: Type '{ params: { memberid: string; name: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ memberid: string; name: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
Static worker exited with code: 1 and signal: null
Type error: Type '{ params: { memberid: string; name: string; }; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type '{ memberid: string; name: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
Static worker exited with code: 1 and signal: null
Pixiebob
once try this
type PageProps= {
params: Promise<{ memberid: string
name: string; }>
}
type PageProps= {
params: Promise<{ memberid: string
name: string; }>
}
Update that page as well
Different page, or different place