apollo-angular: Type 'V' does not satisfy the constraint 'OperationVariables'
Describe the bug
When running apollo angular with angular 15, getting these errors:
- Error: node_modules/apollo-angular/query-ref.d.ts:9:33 - error TS2344: Type ‘V’ does not satisfy the constraint ‘OperationVariables’.
- Error: node_modules/apollo-angular/types.d.ts:23:105 - error TS2344: Type ‘TVariables’ does not satisfy the constraint ‘OperationVariables’.
To Reproduce Steps to reproduce the behavior:
Run apollo-angular package with angular 15 (note: angular project was created with ng new command)
Expected behavior
'It should run without any typescript error.
Environment:
- "@angular/cli": "^15.1.1"
- "@angular/core": "^15.1.0",
- "@apollo/client": "^3.7.4"
- "apollo-angular": "^4.2.0"
- "graphql": "^16.6.0"
- "typescript": "~4.9.4",
Additional context
This compilation error goes away when making strict flag to false in tsconfig.json

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 16
- Comments: 26
Same issue
Check this comment please. For me it was @apollo/client v 3.7.6 that was causing the issue 3.7.5 works fine.
Hi,
I am still experiencing this issue if in the config class I have enabled to create the
sdkClass. It works I ommitsdkClass: true. However, this is super helpful and I really would like to keep using it. The exaxt error message isHere are the parts that are added to
graphql.generated.tsif I setsdkClassto true:Afaik, I should be on a working version of the package.
Solved by #1910, released as 4.2.1.
Mine still does not work, help? “dependencies”: { “@angular/animations”: “^15.1.2”, “@angular/common”: “^15.1.2”, “@angular/compiler”: “^15.1.2”, “@angular/core”: “^15.1.2”, “@angular/forms”: “^15.1.2”, “@angular/platform-browser”: “^15.1.2”, “@angular/platform-browser-dynamic”: “^15.1.2”, “@angular/platform-server”: “^15.1.2”, “@angular/router”: “^15.1.2”, “@capacitor/android”: “^4.6.2”, “@capacitor/cli”: “^4.6.2”, “@capacitor/core”: “^4.6.2”, “@capacitor/ios”: “^4.6.2”, “@nguniversal/express-engine”: “^15.1.0”, “apollo-angular”: “^4.2.0”, “express”: “^4.15.2”, “rxjs”: “~7.5.0”, “tslib”: “^2.3.0”, “zone.js”: “~0.11.4”, “@apollo/client”: “^3.0.0”, “graphql”: “^16” }, “devDependencies”: { “@angular-devkit/build-angular”: “^15.1.3”, “@angular/cli”: “~15.1.3”, “@angular/compiler-cli”: “^15.1.2”, “@nguniversal/builders”: “^15.1.0”, “@types/express”: “^4.17.0”, “@types/jasmine”: “~4.0.0”, “@types/node”: “^14.15.0”, “jasmine-core”: “~4.3.0”, “karma”: “~6.4.0”, “karma-chrome-launcher”: “~3.1.0”, “karma-coverage”: “~2.2.0”, “karma-jasmine”: “~5.1.0”, “karma-jasmine-html-reporter”: “~2.0.0”, “typescript”: “~4.9.4” }
The last versión 3.7.7 have the same error, Im use version 3.7.1 and woks fine to me
Is that issue resolved? I’m still encounter the same issue. Here is my configuration:
Works with 4.2.1-alpha-20230210085539-0e747997. I assume this will have to do until 4.2.1 is relased.
Before comparing all your dependencies, one of you probably should look for what was changed in apollo-client 3.7.6.
Also posting your package.json has a very limited use, because it doesn’t tell what exact version is actually installed. Instead either look at the lock file, or better use
yarn why. But really, first investigate apollo-client.Same issue for me. With versions 3.7.7 and 3.7.6 this issue happens but for 3.7.5 worked as expected.