Angular - apollo-client/core/types.d.ts (17,45): ',' expected

July 19, 2017

Problem:

Starting problems while using the apollo graphQL client:

$ npm install apollo-client apollo-angular graphql-tag –save

(…)
_
$ npm start
 _
(…)

_ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (17,45): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (17,47): ‘>’ expected.

ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (19,2): ‘;’ expected.

ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (19,4): Expression expected.

ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (20,10): Expression expected.

ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (20,5): Cannot find name ‘data’.

ERROR in /(…)/node_modules/apollo-client/core/types.d.ts (20,12): Cannot find name ‘T’.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (8,48): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (8,50): ‘>’ expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (10,2): ‘;’ expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (10,4): Expression expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (11,15): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (11,24): ‘;’ expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (11,49): ‘(’ expected.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (11,6): Cannot find name ‘queryName’.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (11,17): Cannot find name ‘string’.

ERROR in /(…)/node_modules/apollo-client/data/mutationResults.d.ts (11,26): ‘MutationQueryReducer’ only refers to a type, but is being used as a value here.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (47,36): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (47,38): ‘>’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (49,2): Expression expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (50,27): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (51,23): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (52,43): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (53,48): ‘(’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (54,51): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (55,34): ‘(’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (57,41): ‘,’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (57,43): ‘>’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (59,2): ‘;’ expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (59,4): Expression expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (59,74): Expression expected.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (50,15): ‘DocumentNode’ only refers to a type, but is being used as a value here.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (52,26): The left-hand side of an arithmetic operation must be of type ‘any’, ‘number’ or an enum type.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (52,35): The right-hand side of an arithmetic operation must be of type ‘any’, ‘number’ or an enum type.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (53,21): ‘MutationQueryReducersMap’ only refers to a type, but is being used as a value here.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (54,22): Cannot find name ‘string’.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (54,33): ‘PureQueryOptions’ only refers to a type, but is being used as a value here.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (55,14): ‘MutationUpdaterFn’ only refers to a type, but is being used as a value here.

ERROR in /(…)/node_modules/apollo-client/core/watchQueryOptions.d.ts (59,63): Cannot find name ‘T’.

ERROR in /(…)/node_modules/apollo-angular/build/src/Apollo.d.ts (14,24): Generic type ‘MutationOptions’ requires 1 type argument(s).

ERROR in /(…)/src/app/app.module.ts (19,1): Invalid character.

ERROR in /(…)/src/app/app.module.ts (20,1): Invalid character._

Solution:

Update packages.json
“apollo-client”: “^1.9.0”,
“graphql-tag”: “^2.4.2",

with,
“apollo-client”: “^1.0.1”,
“graphql-tag”: “^1.3.1",

execute:
$ rm -rf node_modules
$ npm install apollo-client apollo-angular graphql-tag –save