'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.


Solution 1:[1]

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.

Solution 2:[2]

Make sure all apollo packages (apollo-server, apollo-server-express, apollo-server-core) have the exact same version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Martin Trajanovski