kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 311 forks source link

apollo-angular/types.d.ts error TS2312 on a new Angular 14 app #1818

Closed smacrineanu closed 2 years ago

smacrineanu commented 2 years ago

Describe the bug

After creating a new Angular app using ng new and adding apollo-angular using ng add, the build fails. No other changes were made to the project.

To Reproduce Steps to reproduce the behavior: Create a new Angular app using ng new app-name Add apollo-angular to the app using ng add apollo-angular Serve the application using ng serve

Get the following error:

Error: node_modules/apollo-angular/types.d.ts:11:54 - error TS2312: An interface can only extend an object type or intersection of object types with statically known members.

11 export interface MutationResult<TData = any> extends FetchResult<TData> {

Expected behavior

The app should compile normally

Environment:

├── @angular/cli@14.2.4 ├── @angular/core@14.2.4 ├── @apollo/client@3.7.0 ├── apollo-angular@4.0.1 ├── graphql@15.8.0 └── typescript@4.7.4

Additional context

Node: 16.13.2 Package Manager: npm 8.1.2 OS: win32 x64

frct1 commented 2 years ago

Same thing here after updating to v14 As temporary workaround added // @ts-ignore before line node_modules/apollo-angular/types.d.ts:11

smacrineanu commented 2 years ago

Same thing here after updating to v14 As temporary workaround added // @ts-ignore before line node_modules/apollo-angular/types.d.ts:11

I have tried creating a brand new Angular v13 project and I got the same error. From what version did you update?

frct1 commented 2 years ago

I have tried creating a brand new Angular v13 project and I got the same error. From what version did you update?

Hi I've simply updated ng (from 12 to 14) and packages (tsc too, from 4.3 to 4.8.4) via npm-check-updates. Now facing same issue just after i removed package-lock.json and node_modules/ from root folder and did clean npm install

damilgra commented 2 years ago

I ran into the same issue when updating @apollo/client from 3.6.9 to 3.7.0. I reverted back to 3.6.9

santoro-mariano commented 2 years ago

@smacrineanu I can confirm that @damilgra workaround works with a new angular 14 project (14.2.4)

smacrineanu commented 2 years ago

@smacrineanu I can confirm that @damilgra workaround works with a new angular 14 project (14.2.4)

Yes it works for me aswell, thank you!

groznikg commented 2 years ago

Are there any other workarounds? I have a pipeline for deploying my app so I can't add lines to node_modules

de-dan commented 2 years ago

Hi @groznikg, I use @damilgra 's workaround. In your package.json, instead of "@apollo/client": "^3.6.9", delete the circumflex^ to force npm to use the working version 3.6.9: "@apollo/client": "3.6.9", And wait until it is fixed :)

groznikg commented 2 years ago

Thanks @de-dan Worked like a charm :)

gmiklich commented 2 years ago

As a heads up, I added an issue to the @apollo/client project that outlines the problem with their 3.7.0 release. You can find it here: https://github.com/apollographql/apollo-client/issues/10162

ysantalla commented 2 years ago

I added this lines in tsconfig.json and I fixed the bug. It is a temporaly solutions.

"skipLibCheck": true, "skipDefaultLibCheck": true,

anasvn commented 2 years ago

I ran into the same issue when updating @apollo/client from 3.6.9 to 3.7.0. I reverted back to 3.6.9

Thanks, this update saved me.

kamilkisiela commented 2 years ago

https://github.com/kamilkisiela/apollo-angular/releases/tag/v4.1.0