apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.31k stars 2.65k forks source link

Type error with apollo client package #11131

Closed SaumilNagariya closed 12 months ago

SaumilNagariya commented 1 year ago

Issue Description

Hi team,

We are using node v18.16.1 and apollo-client 3.8.0 for Nexjs Commerce repo. It was working fine till yesterday, but now it is failing the build.

Yarn build

image

can you please help me asap?

Link to Reproduction

n/a

Reproduction Steps

No response

jerelmiller commented 1 year ago

Hey @SaumilNagariya 👋

Could I get a little more info from you. When you say "working fine till yesterday", were you using a prerelease version of 3.8? If so, which one?

Not much has changed between the rc.2 version and the public release version so I'm a bit surprised to see this. Do you have a reproduction that we can dig into further?

alessbell commented 1 year ago

What versions of Next.js and TypeScript are you using? I've tried to reproduce this with no luck so far.

I've cloned the latest https://github.com/vercel/commerce project, pnpm installed @apollo/client@3.8.0 and imported + called useBackgroundQuery in a client component. (For streaming SSR support, you'd want to use our https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support package when using Next.js's app router, but that isn't material to this bug occurring during the build.)

As you can see here, it passes linting and type checking but later fails to generate static pages because I don't have API keys for a Shopify store in my env variables:

CleanShot 2023-08-08 at 12 13 14

alessbell commented 1 year ago

In the meantime, you can try the snapshot release from https://github.com/apollographql/apollo-client/pull/11134 by doing npm i @apollo/client@0.0.0-pr-11134-20230808160421.

This subtly changes the import syntax in the built useBackgroundQuery.d.ts:

- import { type QueryReference } from "../cache/QueryReference.js";
+ import type { QueryReference } from "../cache/QueryReference.js";

But I'd be very curious to look at a reproduction since AFAIK the syntax we're currently using has been supported since TypeScript 4.5.

github-actions[bot] commented 11 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.