Comments (7)
#1263 addresses this and has been merged + released. Thanks all!
from apollo-link.
Also seeing this. The TData
generic doesn't appear to be customized anywhere, so I think it can be removed since the default value is the same as the new non-generic type in the graphql lib? Will open a quick PR in case people with more experience in this package agree.
from apollo-link.
#1263 also has the advantage of doing all the package.json changes!
I do think that the end goal should be to remove this generic parameter from ExecutionResult
. As the upstream comment on this change says, "it's just a glorified typecast" and increases the risk that an end user will introduce bugs by assuming the class will perform some sort of validation on the value being returned.
For now, though, I agree that #1263 does a better job of fixing this issue while minimizing downstream disruption in the short-term. I'd just suggest we should retire this typecast to bring this library in line with graphql
the next time we're willing to release a breaking API change.
from apollo-link.
I also got this issue while using it with NestJS:
D:\project_amanah\soluvas\soluvas-platform-nest>npm run start:dev
> [email protected] start:dev D:\project_amanah\soluvas\soluvas-platform-nest
> nest start --watch
[03:41:16] Starting compilation in watch mode...
node_modules/apollo-link/lib/types.d.ts:23:56 - error TS2315: Type 'ExecutionResult' is not generic.
23 }, C = Record<string, any>, E = Record<string, any>> = ExecutionResult<TData> & {
~~~~~~~~~~~~~~~~~~~~~~
[03:41:32] Found 1 error. Watching for file changes.
package.json snippet:
"dependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/graphql": "^7.2.0",
"@nestjs/platform-fastify": "^7.0.7",
"@nestjs/typeorm": "^7.0.0",
"apollo-server-fastify": "^2.11.0",
"graphql": "^15.0.0",
"graphql-tools": "^4.0.7",
"mysql": "^2.18.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.5.4",
"typeorm": "^0.2.24"
},
"devDependencies": {
"@nestjs/cli": "^7.0.0",
"@nestjs/schematics": "^7.0.0",
"@nestjs/testing": "^7.0.0",
"@types/express": "^4.17.3",
"@types/jest": "25.1.4",
"@types/node": "^13.9.1",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"supertest": "^4.0.2",
"ts-jest": "25.2.1",
"ts-loader": "^6.2.1",
"ts-node": "^8.6.2",
"tsconfig-paths": "^3.9.0",
"typescript": "^3.7.4"
},
Workaround: Downgrade to graphql 14.6.0
"graphql": "<15.0.0",
from apollo-link.
👍 @zackdotcomputer . everyone installing apollo and graphql recently or upgrading the graphql will definitely get this error out of nowhere.
from apollo-link.
#1263 this one doesn't break the current behavior of apollo-link
from apollo-link.
For what it's worth, the generic parameter from ExecutionResult
is (was) also used
- via
FetchResult<TData>
inapollo-client
'sMutationUpdaterFn<T>
- via
MutationUpdaterFn<T>
in@apollo/react
'sBaseMutationOptions<TData>
- via
BaseMutationOptions<TData>
in@apollo/react-hooks
'sMutationHookOptions<TData>
- via
MutationHookOptions<TData>
in code generated by dotansimha/graphql-code-generator
For our project, this effectively renders type-checking of the result from mutation hooks defunct since data
now always is { [key: string]: any }
instead of the actual type derived via code generation from the underlying schema/typedefs.
I am not sure whether this is a serious regression caused by graphql/graphql-js version 15 or is something that needs to be worked around now by higher-order libraries such as apollographql/apollo-link or dotansimha/graphql-code-generator.
from apollo-link.
Related Issues (20)
- onError giving me terminating link and hence, `from` throws LinkError
- '__spreadArrays' was not found
- Axios instance as fetch implementation HOT 1
- How to use apollo-link-batch-http with Angular?
- Multiline package description on npm
- TypeScript error in Header authentication tutorial HOT 1
- apollo-link-ws loads backend modules when using it in the browser HOT 1
- Cannot override `useGETForQueries` to use POST on one specific query
- Request has invalid content type header when using XMLHttpRequest polyfill HOT 1
- How to use 2 terminating Links?
- OnError Apollo i will like to show/display the error HOT 3
- Client - Only absolute URLs are supported
- graphQLErrors returns an empty array for mutations onError
- Integrating websocket link results in constat logging in console HOT 2
- Apollo v3 Beta not working with RetryLink and onError HOT 2
- Pagination Apollo v3
- Update Dependencies (Renovate Bot)
- setContext in the errorLink is not updating the global header token
- operation context gets lost?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-link.