graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

Missing override

Open heddendorp opened this issue 4 years ago • 9 comments

https://github.com/dotansimha/graphql-code-generator/blob/aeaea1ed1d09172a3bf8a9bd4f1d3cd7ab65023b/packages/plugins/typescript/apollo-angular/src/visitor.ts#L302

Should be fixed to prevent error TS4114: This member must have an 'override' modifier because it overrides a member in the base class

heddendorp avatar Feb 06 '22 10:02 heddendorp

Yes, I'm having the same issue where document needs 'override document'

RyannGalea avatar Feb 12 '22 04:02 RyannGalea

This was fixed with release @graphql-codegen/[email protected]

Add addExplicitOverride: true to your config. See https://www.graphql-code-generator.com/plugins/typescript-apollo-angular.

TomONeill avatar Feb 16 '22 13:02 TomONeill

@TomONeill Thank you for your answer. This works.

inpercima avatar Feb 18 '22 09:02 inpercima

Hi, Thanks to your answer but it does not sound to work with the client property if overridden namedClient. Do you have an alternative for this one? Thanks in advance.

yannickglt avatar Feb 18 '22 16:02 yannickglt

I added an issue for this (#7548) and a PR (#7553), but so far it hasn't been approved yet.

TomONeill avatar Feb 18 '22 16:02 TomONeill

Amazing! Thanks a lot. Will disable the check in the tsconfig for now 😊

yannickglt avatar Feb 18 '22 17:02 yannickglt

PR was merged! I think you can close the issue now.

TomONeill avatar Mar 21 '22 09:03 TomONeill

I still have this issue with "@graphql-codegen/typescript-apollo-angular": "^3.4.12" installed :(

CemYil03 avatar Jun 14 '22 06:06 CemYil03

If all else fails, you should be able to set the "noImplicitOverride" compiler option to false in your tsconfig.json file. Depending on how you generated your application, this may have been set to true for you by default.

Gkleinereva avatar Aug 04 '22 20:08 Gkleinereva

"@graphql-codegen/typescript-apollo-angular": "^3.5.5" Problem still there.

wi4er avatar Oct 29 '22 20:10 wi4er

Ran into this "issue" too (with version 3.5.5) but as stated before, all I had to do was to set the addExplicitOverride config flag to true as stated in the documentation.

codegen.ts

import type { CodegenConfig } from '@graphql-codegen/cli';
 
 const config: CodegenConfig = {
   // ...
   generates: {
     'path/to/file': {
       plugins: ['apollo-angular'],
       config: {
         addExplicitOverride: true
       },
     },
   },
 };
 export default config;

The issue should be closed.

akialapiha avatar Nov 15 '22 12:11 akialapiha