adamsoffer / next-apollo

React higher-order component for integrating Apollo Client with Next.js
MIT License
482 stars 64 forks source link

Fix page props type inference #84

Closed lukel97 closed 3 years ago

lukel97 commented 3 years ago

Previously this would fail to typecheck if getInitialProps returned props other than {}, because the splatting/spreading of the ...pageProps when the props were assigned the type WithApolloOptions, meant that the page props type parameter/generic was inferred a type of {}. This shuffles stuff about so that things typecheck.

It also changes the const to a function, otherwise next js complains that it doesn't have a name when hot reloading