question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support TypeScript 4.3 noImplicitOverride in typescript-apollo-angular

See original GitHub issue

Typescript 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
ardatancommented, Aug 10, 2021

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.

1reaction
toveruxcommented, Apr 14, 2022

Well since it’s been solved I’m closing my issue!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found