Error coming from within node_modules apollo-client

When trying to build an app, I see an error coming from the node_modules in regards to apollo-client

Error: node_modules/@apollo/client/cache/core/types/common.d.ts:52:110 - error TS1005: ‘?’ expected.
Typescript version : 4.6.4"
@apollo/client”: “^3.0.0”

There were no updates made to these versions of late, so not sure what could be causing this.

Could you please check which exact version of Apollo Client you are using? ^3.0.0 describes a very large range of different Apollo Client versions.

I have a similar issue with apollo/client on my angular application. It stopped working without any changes made on modules.

Error: node_modules/@apollo/client/cache/core/types/common.d.ts:52:110 - error TS1005: ‘?’ expected. My typescript version is “typescript”: “~4.0.2”
“apollo-angular”: “^2.4.0”,
@apollo/client”: “^3.3.18”,

Hard coding the apollo/client version would help. I am moving to @apollo/client : 3.7.7

@tinyikosnr if you write ^3.3.18 in your package.json, that allows your package manager to randomly choose one of the following versions:

  • 3.3.18
  • 3.3.19
  • 3.3.20
  • 3.3.21
  • 3.4.0
  • 3.4.1
  • 3.4.2
  • 3.4.3
  • 3.4.4
  • 3.4.5
  • 3.4.6
  • 3.4.7
  • 3.4.8
  • 3.4.9
  • 3.4.10
  • 3.4.11
  • 3.4.12
  • 3.4.13
  • 3.4.14
  • 3.4.15
  • 3.4.16
  • 3.4.17
  • 3.5.0
  • 3.5.1
  • 3.5.2
  • 3.5.3
  • 3.5.4
  • 3.5.5
  • 3.5.6
  • 3.5.7
  • 3.5.8
  • 3.5.9
  • 3.5.10
  • 3.6.0
  • 3.6.1
  • 3.6.2
  • 3.6.3
  • 3.6.4
  • 3.6.5
  • 3.6.6
  • 3.6.7
  • 3.6.8
  • 3.6.9
  • 3.6.10
  • 3.7.0
  • 3.7.1
  • 3.7.2
  • 3.7.3
  • 3.7.4
  • 3.7.5
  • 3.7.6
  • 3.7.7
  • 3.7.8
  • 3.7.9
  • 3.7.10
  • 3.7.11
  • 3.7.12
  • 3.7.13
  • 3.7.14
  • 3.7.15
  • 3.7.16
  • 3.7.17
  • 3.8.0
  • 3.8.1
  • 3.8.2
  • 3.8.3
  • 3.8.4
  • 3.8.5
  • 3.8.6

As a result, I can’t tell which version you are actually using in your application.

You can try out this behaviour on this page

That said, I can pinpoint your error now: your version of TypeScript is very outdated and doesn’t support the TypeScript syntax we are using by now anymore. Please upgrade to at least TypeScript version 4.8 or enable the skipLibCheck option in your tsconfig.json (in some edge case scenarios the AC types will behave weird to you though, if you choose that option).