Next.js Discord

Discord Forum

Getting Typescript Errors

Unanswered
Turkish Angora posted this in #help-forum
Open in Discord
Avatar
Turkish AngoraOP
app/(auth-pages)/sign-in/page.tsx
Type error: Type '{ searchParams: Message; }' does not satisfy the constraint 'PageProps'.
Types of property 'searchParams' are incompatible.
Type 'Message' is not assignable to type 'Promise<any> | undefined'.


javascript import { signInAction } from "@/app/actions"; import { FormMessage, Message } from "@/components/form-message"; import { SubmitButton } from "@/components/submit-button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import Link from "next/link"; export default function Login({ searchParams }: { searchParams: Message }) { return ( <form className="flex-1 flex flex-col min-w-64"> <h1 className="text-2xl font-medium">Sign in</h1> <p className="text-sm text-foreground"> Don't have an account?{" "} <Link className="text-foreground font-medium underline" href="/sign-up"> Sign up </Link> </p> <div className="flex flex-col gap-2 [&>input]:mb-3 mt-8"> <Label htmlFor="email">Email</Label> <Input name="email" placeholder="you@example.com" required /> <div className="flex justify-between items-center"> <Label htmlFor="password">Password</Label> <Link className="text-xs text-foreground underline" href="/forgot-password" > Forgot Password? </Link> </div> <Input type="password" name="password" placeholder="Your password" required /> <SubmitButton pendingText="Signing In..." formAction={signInAction}> Sign in </SubmitButton> <FormMessage message={searchParams} /> </div> </form> ); }

1 Reply

Avatar
Asian black bear
Since Next 15 the searchParams are a Promise that you need to await.