Type 'ExecutionResult' is not generic

When Setting Up a Front-End Extension Module step 7 Build Core an error occur when executing

yarn run build:core or yarn run build-dev:core

the following is the output after executing the commands

Building entry point ‘core’

:heavy_multiplication_x: Compiling with Angular sources in Ivy full compilation mode.
node_modules/@apollo/client/utilities/common/errorHandling.d.ts:2:55 - error TS2315: Type ‘ExecutionResult’ is not generic.

2 export declare function graphQLResultHasError(result: ExecutionResult): boolean;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@apollo/client/link/core/types.d.ts:19:134 - error TS2315: Type ‘ExecutionResult’ is not generic.

19 export interface FetchResult<TData = Record<string, any>, TContext = Record<string, any>, TExtensions = Record<string, any>> extends ExecutionResult<TData, TExtensions> {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error Command failed with exit code 1.

Hi @bkm,

Thank you for the feedback.

There is a know issue in apollo that matches the problem you’ve described. Though it is just for more recent version:

Just a few questions to try and understand the problem.

1. What version of apollo are you using?

You can run yarn list --pattern @apollo/client

You should get something like:

... $ yarn list --pattern @apollo/client
yarn list v1.22.10
└─ @apollo/client@3.4.11
Done in 0.93s.

2. Did you run yarn upgrade?

yarn install should use the version specified in the yarn.lock file which is:

"@apollo/client@^3.0.0-beta.23", "@apollo/client@^3.3.7":
  version "3.4.11"
3. Version check

The following are the versions I have, are any of yours different?

  • To get this info I’ve run ng --version
$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.1.0
Node: 14.18.2
Package Manager: yarn 1.22.10
OS: linux x64

Angular: 12.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.14
@angular-devkit/build-angular   12.2.14
@angular-devkit/core            12.1.0
@angular-devkit/schematics      12.1.0
@angular/cdk                    11.2.13
@schematics/angular             12.1.0
ng-packagr                      12.2.6
rxjs                            6.6.7
typescript                      4.3.5
webpack                         5.65.0

Hi @clemente.raposo ,

after running yarn install , the yarn run build-dev:core works fine but when yarn run build-dev:shell the apollo/client still errors

Error: core/app/shell/src/app/app.module.ts:149:13 - error TS2322: Type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink’ is not assignable to type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink’.

149 link: logoutLink.concat(http),
~~~~

node_modules/@apollo/client/core/ApolloClient.d.ts:19:5
19 link?: ApolloLink;
~~~~
The expected type comes from property ‘link’ which is declared here on type ‘ApolloClientOptions’

Error: core/app/shell/src/app/app.module.ts:149:37 - error TS2345: Argument of type ‘HttpLinkHandler’ is not assignable to parameter of type ‘ApolloLink | RequestHandler’.
Type ‘HttpLinkHandler’ is not assignable to type ‘ApolloLink’.
Types of property ‘split’ are incompatible.
Type ‘(test: (op: import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/types").RequestHandler, ri…’ is not assignable to type ‘(test: (op: import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/…’.
Types of parameters ‘left’ and ‘left’ are incompatible.
Type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/types").RequestHandler’ is not assignable to type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/types").RequestHandler’.
Type ‘ApolloLink’ is not assignable to type ‘ApolloLink | RequestHandler’.
Type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink’ is not assignable to type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink’.
Types of property ‘split’ are incompatible.
Type ‘(test: (op: import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/…’ is not assignable to type ‘(test: (op: import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/types").Operation) => boolean, left: import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/types").RequestHandler, ri…’.
Types of parameters ‘left’ and ‘left’ are incompatible.
Type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/types").RequestHandler’ is not assignable to type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink | import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/types").RequestHandler’.
Type ‘ApolloLink’ is not assignable to type ‘ApolloLink | RequestHandler’.
Type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink’ is not assignable to type ‘import("/home/pivotdev1/ftp/files/node_modules/@apollo/link-error/node_modules/@apollo/client/link/core/ApolloLink").ApolloLink’.
Property ‘onError’ is protected but type ‘ApolloLink’ is not a class derived from ‘ApolloLink’.

149 link: logoutLink.concat(http),
~~~~

Error: node_modules/@apollo/client/utilities/globals/global.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable ‘DEV’.

2 const DEV: boolean | undefined;
~~~~~~~

node_modules/@apollo/link-error/node_modules/@apollo/client/utilities/globals/global.d.ts:2:11
2 const DEV: boolean | undefined;
~~~~~~~
DEV’ was also declared here.

Error: node_modules/@apollo/link-error/node_modules/@apollo/client/utilities/globals/global.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable ‘DEV’.

2 const DEV: boolean | undefined;
~~~~~~~

node_modules/@apollo/client/utilities/globals/global.d.ts:2:11
2 const DEV: boolean | undefined;
~~~~~~~
DEV’ was also declared here.

error Command failed with exit code 1.

Hi @bkm,

Thank you for the feedback. And apologies for the delay.

Could you check what version on yarn.lock please? is it the same as the one I sent on the previous post?

Could you also run ng --version and send it, please? just to double check.

Hi,
I also had the same problems as @bkm , now if I run the yarn run command build-dev:shell
I get the following error:

My Angular version is:

Any Idea?

Thanks