You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionApp({ Component, pageProps }: AppProps){return(<><Head><linkrel="icon"href="/favicon.ico"/><metaname="viewport"content="width=device-width"/></Head><Providers><Component{...pageProps}/></Providers></>);}// next-with-apollo will run this and we want our pages' getInitialProps to run as wellApp.getInitialProps=async({ Component, ctx })=>{letpageProps={};if(Component.getInitialProps){pageProps=awaitComponent.getInitialProps(ctx);}return{ pageProps };};exportdefaultwithApollo(App);// ts error here ^
Argument of type 'typeof App' is not assignable to parameter of type 'typeof App | (ComponentClass<any, any> & { getInitialProps?(context: NextPageContext): any; }) | (FunctionComponent<any> & { ...; })'.
Type 'typeof App' is not assignable to type 'FunctionComponent<any> & { getInitialProps?(context: NextPageContext): any; }'.
Type 'typeof App' is not assignable to type '{ getInitialProps?(context: NextPageContext): any; }'.
Types of property 'getInitialProps' are incompatible.
Type '({ Component, ctx }: { Component: any; ctx: any; }) => Promise<{ pageProps: {}; }>' is not assignable to type '(context: NextPageContext) => any'.
Types of parameters '__0' and 'context' are incompatible.
Type 'NextPageContext' is missing the following properties from type '{ Component: any; ctx: any; }': Component, ctxts(2345)
i.e. the accepted input on L26 is one of Page or App (the nextjs component, not a functional component that performs the same operations)
i.e. the accepted input on L26 is one of
Page
orApp
(the nextjs component, not a functional component that performs the same operations)since the nextjs recommended custom app is now the functional component version, it'd be good to allow that: https://nextjs.org/docs/advanced-features/custom-app
as a workaround, erasing the type with
App as any
means we pass the type check and the code stills functions as expected.The text was updated successfully, but these errors were encountered: