-
-
Notifications
You must be signed in to change notification settings - Fork 760
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
Next.js 12.3.0 AppProps generic breaks appWithTranslation type #1944
Comments
Would you like to send a Pull Request to address this? |
This change is to allow compatibility for [email protected]
@adrai @matchatype I've opened a PR that apparently addresses the issue: #1948 |
@matchatype let me know if this works for you, then we'll merge that PR and release a new version |
@gazs I don't think you want to do that. What you want is extend |
pageProps is |
Stumbled about the same problem using react-query with appWithTranslation. react-query requires a dehydratedState field in pageProps, extending pageProps causes the error described. |
I have the same issue here. Is there a way to solve this problem locally? |
I'm sorry, I don't time to help right now, but I guess you can trick TS with the following: export default appWithTranslation<never>(App) |
you can use this till they fix this bug |
Thanks Ebrahim, worked for me with a little tweak: |
Is declaring a PageProps type which extends type PageProps = SSRConfig & Record<string, any>
<AppProps<PageProps>> |
As I see it, the PR is actually correct. So #1948 would fix this. It can even include some cleanup in the function, as there are a few redundant if-checks. Ref the "extending with what pageProps are" solution; is it even possible in Typescript as of today? Wouldn't that be a higher kind type, which isn't implemented? Ref microsoft/TypeScript#1213 Also, extending the type would still require the caller to send in the SSRConfig, which is not expected. Another workaround:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
stale bump |
a new major version will be published as soon as -> #1966 |
@adrai the work done (amazing work by the way, just read up on all the activity over the last month on this project) concluded 9 days ago - is the v13.0.0 tag imminent? |
Just a TypeScript topic needs to be done and maybe another package optimization... then v13 will be released. |
Next.js 12.3.0 #38867 introduces the use of a generic for AppProps type, that is incompatible with
appWithTranslation
type.To Reproduce
The following example causes a TypeScript error (TS2345):
Argument of type '({ Component, pageProps }: AppProps<{ session: Session;}>) => JSX.Element' is not assignable to parameter of type 'ComponentType<AppProps>'
.The text was updated successfully, but these errors were encountered: