Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I solve this Apollo Control Cache error?

I am trying to set up my server side backend and I'm hitting this error:

node_modules/apollo-cache-control/dist/index.d.ts:24:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'cacheControl' must be of type 'ResolveInfoCacheControl', but here has type '{ setCacheHint: (hint: CacheHint) => void; cacheHint: CacheHint; }'.

24         cacheControl: {
           ~~~~~~~~~~~~

  node_modules/@nestjs/graphql/node_modules/apollo-server-types/dist/index.d.ts:140:9
    140         cacheControl: ResolveInfoCacheControl;
                ~~~~~~~~~~~~
    'cacheControl' was also declared here.
like image 444
Clint Maruti Avatar asked Nov 07 '22 00:11

Clint Maruti


1 Answers

I just found a fix for this, You have to add this to your tsconfig.json file:

"skipLibCheck": true

My tsconfig.json looks like:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "target": "es2015",
    "noImplicitAny": false,
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "lib",
    "baseUrl": "./",
    "lib": ["es6", "esnext.asynciterable"],
    "types": ["node"],
    "skipLibCheck": true
  },
  "include": ["src/**/*"]
}

And also make sure to have all apollo packages to have same exact version.

like image 60
Ilyas karim Avatar answered Dec 04 '22 09:12

Ilyas karim