question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next.js 12.3.0 AppProps generic breaks appWithTranslation type

See original GitHub issue

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>'.

const App = ({Component, pageProps}: AppProps<{session: Session}>) => (
  <SessionProvider session={pageProps.session}>
    <ThemeProvider>
      <Component {...pageProps} />
    </ThemeProvider>
  </SessionProvider>
)

export default appWithTranslation(App)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:22
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
aziaziazicommented, Sep 20, 2022

you can use this till they fix this bug export default appWithTranslation(MyApp) as FC

Thanks Ebrahim, worked for me with a little tweak: export default appWithTranslation(MyApp as FC)

2reactions
adraicommented, Oct 25, 2022

a new major version will be published as soon as -> #1966

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blog - Next.js 12.3
Next.js 12.3 introduces TypeScript Auto-Install, improved Fast Refresh, stable new Image Component, and more!
Read more >
next-i18next - Bountysource
Next.js 12.3.0 #38867 introduces the use of a generic for AppProps type, that is incompatible with appWithTranslation type.
Read more >
How to use next-auth with per page layouts in Next.js with ...
You can add a generics type to AppPropsWithLayout , then use it in the MyApp 's props type and pass the right type...
Read more >
next-i18next's Language Statistics - Codesti
Issue Title State Comments Created Date Upd... Module not found: Can't resolve 'react‑i18next' closed 1 2022‑12‑11 2022... Text content does not match server‑rendered HTML. closed...
Read more >
Internationalize the Next.js application using next-i18next
_app.tsximport type { AppProps } from “next/app”; import “../styles/globals.css”; import { appWithTranslation } from “next-i18next”;function MyApp({ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found