Support TypeScript 4.3 noImplicitOverride in typescript-apollo-angular
See original GitHub issueTypescript 4.3 introduced a new override
keyword and the noImplicitOverride
rule.
It would be nice to support this keyword with a new option, as the typescript-apollo-angular plugin generates subclasses of Apollo’s Mutation
classes and overrides Mutation.document
, for example:
export class AuthResetPasswordUserUpdatePasswordGQL extends Apollo.Mutation<AuthResetPasswordUserUpdatePasswordMutation, AuthResetPasswordUserUpdatePasswordMutationVariables> {
document = AuthResetPasswordUserUpdatePasswordDocument;
// ...
}
As I use noImplicitOverride
in my project, unfortunately the generated code breaks the compilation with this kind of errors:
Error: apps/client/client.gen.graphql.ts:771:5 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Mutation<AuthLoginLoginWithPasswordMutation, Exact<{ email: string; password: string; }>>'.
771 document = AuthLoginLoginWithPasswordDocument;
~~~~~~~~
Correct code output with this rule would be:
export class AuthResetPasswordUserUpdatePasswordGQL extends Apollo.Mutation<AuthResetPasswordUserUpdatePasswordMutation, AuthResetPasswordUserUpdatePasswordMutationVariables> {
override document = AuthResetPasswordUserUpdatePasswordDocument;
// ...
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Use override in typescript generation · Issue #7038 - GitHub
TypeScript 4.3 added a new feature to explicitly mark class override. It can be enabled with the noImplicitOverride compiler option.
Read more >TSConfig Option: noImplicitOverride - TypeScript
How to create and type JavaScript variables. TypeScript in 5 minutes. An overview of building a TypeScript web app. TSConfig Options.
Read more >TypeScript analysis fails to complete with compiler option ...
Hello, I got an issue with SonarScanner where adding the compiler option “noImplicitOverride” breaks the analysis partly.
Read more >override and noImplicitOverride for TypeScript class inheritance
In this # TypeScript #tutorial we look at an exciting new feature in TypeScript 4.3. 6 years in the making its finally landed....
Read more >Announcing TypeScript 4.3 - Microsoft Developer Blogs
Separate Write Types on Properties · override and the --noImplicitOverride Flag · Template String Type Improvements · ECMAScript #private Class ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This would be breaking change if we make it by default. It would be better to have it with a configuration flag. We’d love to accept PRs for this change.
Well since it’s been solved I’m closing my issue!