-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ vercel ] deployment failure - Type 'Component<{}, any, any>' is not assignable to type 'Element | ElementClass | null' in _app.tsx #36019
Comments
We're experiencing this issue as well starting today. We saw that some packages were updated, and these too:
I forced resolutions on both packages to the last version that we used 17.0.11 and everything works as it should. For us the update to version 18.00, released yesterday btw, is coming from this
|
Same issue here...I tried both updating and downgrading dependencies but it never works in vercel. |
Our team had the same issue appear yesterday. It was quite the headache. We eventually fixed it by pinning our dependencies. |
same error for me too - i tried to force resolution of @types/react & @types/react-dom to 17.0.11 without success in fixing issue. unable to deploy successfully |
I also got this error since 24 hours ago. and could not solve yet |
same issue in
|
same issue here, i couldn't deploy stuff because of this error. Tried both upgrading and downgrading |
The same issue are opened: #35986 People, the same error occurs with my apps.
it's a temporary solution. |
Seems like this is still an issue, I tried downgrading and using the packages version to the last successfully deployed versions, has there been any solutions other than this above?
|
In my case the I recommend inspecting your yarn.lock / package-lock.json and see which packages install the 18.0.0 versions for @types/react and @types/react-dom and why. I used yarn resolutions to pin mine to an earlier working version, but it's still a workaround. |
All of the reported issues here are coming from upstream/third-party libraries, and are not related to Next.js. These should be reported on the respective repositories. Some useful links:
I'm closing this for now. If you still think there is a problem with Next.js itself, please provide a reproduction in a new issue so we can look more into it. |
Hello @balazsorban44 , are you sure about this? The issue reports the type error about // _app.tsx
import type { AppProps } from "next/app";
export default function MyApp({ Component, pageProps }: AppProps) {
// the line below produce the typescript error
return ( <Component {...pageProps} />);
} and there's no third party code, just nextjs |
Yes, I could not reproduce a build error. Although you can try upgrading to If you still have an issue, could you attach a full reproduction, and maybe a link to the deployment that fails? |
Indeed, my fault: I had the wrong version of |
LOL, It seems nobody wants to take charge of this issue. Dan Abramov breaks things and says: "think if TypeScript is necessary for your project". And then Vercel, Next.js's Anyway, I solved this issue using yarn,
Specifying
That ends in downloading |
Looking at AppProps the type seems correct? Can you expand on what you'd like to change to AppProps? It does not take export type AppProps = Pick<CompletePrivateRouteInfo, 'Component' | 'err'> & {
router: Router
} & Record<string, any> |
I think I happened upon this in a way that might be related to Next.js. For me it happens when dynamically importing components:
Packages:
This happens when importing any component. Would a reproduction be useful to you guys? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Thank you @adrianescat. Anyone who needs to use npm, you can use overrides instead of resolutions.
Read more here, if you want to learn more. |
Fix error: [0] src/App.tsx(9,34): error TS2769: No overload matches this call. [0] Overload 1 of 2, '(props: (RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>) | Readonly<RouteProps<string, { ...; }> & OmitNative<...>>): Route<...>', gave the following error. [0] Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType<any>'. [0] Type 'typeof Home' is not assignable to type 'ComponentClass<RouteComponentProps<any, StaticContext, unknown>, any>'. [0] The types of 'contextType.Provider.propTypes.children' are incompatible between these types. [0] Type 'React.Validator<React.ReactNode>' is not assignable to type 'import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").Validator<import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode>'. [0] Type 'React.ReactNode' is not assignable to type 'import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode'. [0] Type '{}' is not assignable to type 'ReactNode'. [0] Overload 2 of 2, '(props: RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>, context: any): Route<...>', gave the following error. [0] Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType<any>'. Inspired by: vercel/next.js#35986 vercel/next.js#36019 Fixes jaredpalmer#1867
update @types/react to the latest version |
Did you manage to fix it @creativiii? That's exactly what's happening in one of my projects. |
Solved this by type casting const C = Component as FunctionComponent;
return (
<C {...pageProps} />
) |
IDK if this helps anyone but I was running into a similar issue. I updated |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
next: 12.1.0 react: 17.0.2 react-dom: 17.0.2
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
unable to reproduce locally as
next build
succeeds, it only seems to occur when triggering a deployment on vercel, no matter what I try.sorry if I'm missing something obvious, if anyone has experienced the same would really appreciate a tip on how to resolve. thanks
Expected Behavior
vercel deployment should succeed as normal, seeing as no real updates have been made to the codebase since last deployment.
To Reproduce
triggering a fresh deployment from vercel for an existing nextjs project. I can create a reproduction repo if needed.
my tsconfig:
The text was updated successfully, but these errors were encountered: