Next.js Discord

Discord Forum

Can not create async page component with TypeScript

Unanswered
L1nd posted this in #help-forum
Open in Discord
When I try to create an async page component, I get the following error message from TypeScript:
Initializer type ({params}: {params: any}) => Promise<JSX.Element> is not assignable to variable type FC<Params>

The strange thing, this problem only occurs on my machine, my friend doesn't have this issue with the exact same code.

This is my page component:
import {FC} from "react";

type Params = {
    params: {
        employeeId: string;
    }
}


const EmployeePage: FC<Params> = async ({params}) => {
    return (
        <>
        </>
    );
};

export default EmployeePage;


Package versions for this project:
├── @types/node@20.14.10
├── @types/react-dom@18.3.0
├── @types/react@18.3.3
├── next@14.2.4
├── react-dom@18.3.1
├── react@18.3.1
└── typescript@5.5.3

0 Replies