Next.js Discord

Discord Forum

Parameter 'props' implicitly has an 'any' type

Answered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
Hello, I am getting this error in my code and I would like to know how I can solve it. This is my code:
import { getDictionary } from '@/app/translation/dictionary';
import SignUp from '@/components/SignUpProcess/page';

const Page = async (props) => {
    const data = await getDictionary(props.params.lang); // Changed to props.params.lang
    return (
        <>
        <SignUp dictionary={data} />
        </>
    );
}

export default Page;
Answered by Cape horse mackerel
well, then it is
type Props = {
  params: {
    lang: "en" | "ro";
  }
}
View full answer

4 Replies

Cape horse mackerel
well you have to define a type for the props
type Props = {
  params: {
    lang: string;
  }
}

const Page = async (props: Props) => ()
Cause if yes, I get another error when doing so
Cape horse mackerel
well, then it is
type Props = {
  params: {
    lang: "en" | "ro";
  }
}
Answer