apollographql / apollo-client-nextjs

Apollo Client support for the Next.js App Router
https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support
MIT License
436 stars 32 forks source link

PreloadQuery typescript error #314

Closed jovanblazek closed 3 months ago

jovanblazek commented 3 months ago

When exporting PreloadQuery from registerApolloClient I am getting the following typescript error.

Exported variable 'PreloadQuery' has or is using name 'PreloadQueryComponent' from external module "<path>/node_modules/@apollo/client-react-streaming/dist/combined" but cannot be named.

Code: (same as in readme)

export const { getClient, query, PreloadQuery } = registerApolloClient(
  () =>
    new ApolloClient({
      cache: new InMemoryCache(),
      link: new HttpLink({
        uri: 'http://example.com/api/graphql',
      }),
    })
)
phryneas commented 3 months ago

Hmm, that could happen if you have declarations: true in your tsconfig.json and don't explicitly add @apollo/client-react-streaming to your dependencies (which you shouldn't need to). I'll see that I re-export that type.

phryneas commented 3 months ago

Could you please try this build from #315 and report back if it fixes your problem?

npm i @apollo/experimental-nextjs-app-support@0.0.0-commit-release.0.1718188292.62716af
jovanblazek commented 3 months ago

@phryneas That fixed it 🚀

github-actions[bot] commented 3 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.