An error has occurred: Type 'x' is not compatible with type 'x' (during Vercel deployment)

I encountered an issue during Vercel deployment which displays the following error message:

-

Type error: Type ' ({ params }: DashboardPageProps) = Promise' is not compatible with type 'FC<.DashboardPageProps>'

Type 'Promise‹Element>' cannot be assigned to type 'ReactElement<any, any>

Below is the content of the

./app/(dashboard)/[storeId]/(routes)/page.tsx
file:


// necessary imports

interface DashboardPageProps {
    params: { storeId: string }
}

const DashboardPage: React.FC<DashboardPageProps> = async ({
    params
}) => {
const totalRevenue = await getTotalRevenue(params.storeId);
    const salesCount = await getSalesCount(params.storeId);
    const stockCount = await getStockCount(params.storeId);
    const graphRevenue = await getGraphRevenue(params.storeId)

    return (
     //content for DashboardPage component
    )

You can find the repository at: https://github.com/volfcan/ecommerce-admin

Answer №1

The usage of React.FC is intended for regular (client-side) React components. In this context, it appears that the DashboardPage function may be a server-side component (returning a promise) which is not suitable for React.FC. To resolve this error, simply eliminate the use of React.FC

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

typescript page objects in protractor are showing an undefined property

Hey there, I'm facing an issue while using POM in Protractor with TypeScript in Angular CLI. The error I'm encountering is "Cannot read property 'sendUsername' of undefined". Since I'm new to TypeScript, can someone guide me on how ...

Error: Incorrect format detected. Expected a numerical value, but received: "t". This issue occurred when attempting to provide a slug URL to the GraphQL query function within a Next.js application

Encountering an error while attempting to retrieve content based on the URL. Here is the query function being used: const getSlugQuery = (slug) => { const SLUG_QUERY = gql` query ($slug: String!) { postCollection(where:{slug:${slug}}) { ...

After a successful sign-in on next-auth.js using next.js middleware, users are automatically redirected to the sign-in page

I have integrated next-auth.js with Google as the login provider and Django as the backend to protect pages in my Next.js application. In order to achieve this, I am trying to integrate next-auth.js with Next.js middleware. Reference link The issue I&apos ...

Can you explain what vercel is trying to convey with the message "Invalid request: should NOT have additional property `route`. Please remove it"?

I'm unsure about this I'm not entirely sure what that signifies. I've checked to see if it pertains to my route folder or something else, but I'm still confused. Can someone please assist me in understanding this? ChatGPT hasn't p ...

Looping through an array of objects with Angular 4's ngFor directive to dynamically display content

I am working with Angular 4 and I am attempting to iterate through an array of objects to present the data in Angular Material grid tiles. The code snippet from my HTML file (app.component.html) is as follows: <div class="list" *ngIf="listContacts == t ...

What could be the reason for the discrepancy between my get_token() function and the value obtained from request.META.get("CSRF_COOKIE")?

Can anyone shed light on why I'm facing this particular issue? I am currently exploring the integration of Angular 17 as a Frontend with Django as a Backend. While validating a form, I encountered an issue where the token obtained from Django does no ...

What is the solution for addressing the deprecation warning "The 'importsNotUsedAsValues' flag will no longer work in TypeScript 5.5"?

Is anyone familiar with how to resolve this tsconfig error? The flag 'importsNotUsedAsValues' is outdated and will no longer work in TypeScript 5.5. To address this error, use 'ignoreDeprecations: "5.0"' or switch to using & ...

The typescript compiler encounters an error when processing code that includes a generator function

Recently, I started learning about TypeScript and came across the concept of generators. In order to experiment with them, I decided to test out the following code snippet: function* infiniteSequence() { var i = 0; while(true) { yield i++ ...

Obtain the dimensions (width and height) of a collection of images using Angular and TypeScript

Currently, I am facing an issue with my image upload functionality. My goal is to retrieve the width and height of each image before uploading them. However, I've encountered a problem where my function only provides the dimensions for the first image ...

Encountered a React select error following an upgrade: specifically, a TypeError stating that dispatcher.useInsertionEffect is not

Recently, I updated the react-select library and to my surprise, it stopped working altogether. Despite consulting the official site and the provided Upgrade guide, I couldn't find any helpful information. I also explored the samples on their website ...

Dealing with 404 page not found error without replacing the default in Next.js 13

I followed the Next.js 13 documentation's suggestion to create a file called not-found.jsx in my app directory to handle 404 errors. But, despite placing it inside the app directory and intended for layout and loading purposes, it is not overriding th ...

In what ways does PROJEN streamline project configuration for infrastructure and application projects?

Exploring PROJEN and AWS CDK has raised questions for me regarding how PROJEN contributes to standardizing project configurations in the context of multiple projects or repositories. While I see its usefulness for a single project or repository through the ...

How to stop the page from scrolling up when a component is recreated in NextJS/React

I have developed an application where users can post comments and edit them using markdown. However, I am facing an issue when I press the edit button to change the editing state – the markdown editor is created correctly but the page automatically scrol ...

There was an error trying to read properties of undefined, specifically the 'prototype', in a code using Next.Js and Express

While attempting to incorporate express into my next.js project, I encountered errors when trying to initialize express: const express = require('express'); The errors that appeared were: Module not found: Can't resolve 'async_hooks ...

The parameter must be of type 'string', but you are attempting to assign a 'Promise<any>'

Starting a React App requires fetching the user's information from localStorage and initiating a socket connection with the server based on the user's id. However, when trying to pass the user's id to the socket function, TypeScript throws ...

Angular2 data binding does not update when properties change

I'm struggling to establish the connection between the fields and the component in order for them to update when the properties change in OnDataUpdate(). The field "OtherValue" successfully binds two ways with the input field, and the "Name" field di ...

Javascript Library Issue: "Implicitly Declared Type 'Any' Error"

I am currently in the process of developing a JavaScript library that will interact with an API. My goal is to create a module that can be easily published on npm and utilized across various frameworks such as Angular or React. Below is the code snippet fo ...

Error: Unable to find the definition for Image (Next.js)

This new component in my next js project allows me to write a quote on an image and display it on the canvas. However, I am encountering an issue with the Image() function in JavaScript which typically runs on the browser. It seems that Next.js first execu ...

Obtaining specific information about the target item that a source item was dropped on (using ng2-dragula in Angular)

Issue: I need assistance in implementing the following functionality using the ng2-dragula drag behavior. I am working on creating a feature similar to the app-launcher found on iOS and Android devices. I aim to drag an item A and drop it onto anothe ...

Strategies for transferring retrieved data to the getServerSideProps function

I am currently utilizing the Context API to retrieve data and then pass that data to the getServerSideProps function, but encountering the following error: The React Hook "useContext" is being called in a function "getServerSideProps" that is neither a Re ...