-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Suggestion
π Search Terms
quick fix, code action, override
β Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
β Suggestion
When selecting the quick fix action Implement inherited abstract class
the generated method signatures should include the override keyword which has been present since version 4.3.
class AdyenPaymentProvider extends LoggingPaymentProvider {
protected override claimBalance(paymentReference: string, userId?: number | undefined): boolean {
throw new Error('Method not implemented.');
}
}
instead of
class AdyenPaymentProvider extends LoggingPaymentProvider {
protected claimBalance(paymentReference: string, userId?: number | undefined): boolean {
throw new Error('Method not implemented.');
}
}
π Motivating Example
The autogenerated @Override
annotation in Eclipse/java has helped me catch many subtle bug which would have otherwise taken a long time to track down. No harm is done adding the keyword automatically as it will promote the usage of said keyword to a wider audience which will result in better quality code down the line.
In conjunction with changes like #8306 typescript's OOP would simply be less error prone due to stricter enforcements down the line.
Metadata
Metadata
Assignees
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript