Uh oh!
There was an error while loading. Please reload this page.
--noImplicitOverride - #39669
Conversation
Kingwl
commented
Jul 20, 2020
@typescript-bot run dt. |
Hey @Kingwl, I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build. |
Kingwl
commented
Aug 19, 2020
Emmmm.... Need review and feedback |
Kingwl
commented
Aug 19, 2020
@typescript-bot pack this. |
Hey @Kingwl, I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build. |
Kingwl
commented
Aug 19, 2020
@typescript-bot pack this. |
DanielRosenwasser
commented
Mar 26, 2021
Yeah, I doubt we'll see anything significant, and I will likely merge if it's not too crazy seeing as we can optimize later. |
typescript-bot
commented
Mar 26, 2021
@DanielRosenwasser Here they are:Comparison Report - master..39669
System
Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Kingwl
commented
Mar 26, 2021
The benchmark looks good, at least with the option off. |
typescript-bot
commented
Mar 26, 2021
@DanielRosenwasser Here they are:Comparison Report - master..39669
System
Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jack-Works
commented
Apr 7, 2021
Is this expected? For code classQ{y(){}}classTextendsQ{overridey(){}}The nightly playground emits the following JS code "use strict";classQ{y(){}}classTextendsQ{overridey(){}}which IMO is invalid. Is |
@Jack-Works Nope. Fixed in #43536. |
danfma
commented
Apr 23, 2021
The compiler is complaining about the missing override keyword for constructor declared properties but it doesn't allow using the modifier on the constructor too. |
andrewbranch
commented
Apr 23, 2021
@danfma can you give an example? |
danfma
commented
Apr 23, 2021
Kingwl
commented
Apr 24, 2021
Would we consider to add quickfix for parameter property or allow override in parameter property as @danfma said.😂 |
By the way, this language feature fits me very well because I'm using an AST transformer to apply some Mobx decorators, and one of these modifiers is the “override” decorator! So, I can read the modifier and translate the code to what Mobx needs! Thus, thank you! 😬 |
andrewbranch
commented
Apr 26, 2021
@Kingwl I think we’re going to allow |
Kingwl
commented
Apr 26, 2021
Okay. Looking forward for the good news :XP |
jogibear9988
commented
May 1, 2021
I've problems with static fields and override: #43916 |
SLaks
commented
Jun 8, 2021
What about methods that implement interface (as opposed to base class) members? |
Kingwl
commented
Jun 9, 2021
No plan yet. |
guilhermesimoes
commented
Sep 30, 2021
Is there a way to apply this to my entire project except to classes that inherit from a particular class (like |
Same question/need as @guilhermesimoes - getting errors on without a way to exclude these (either by name, e.g. I realize that the TS team is not likely to want to have React-specific things in its codebase, but I just wanted to bring more attention to a common pain point with this feature for a subset of your users :) Example errors for reference: ERRORinsrc/SomeComponent/index.tsx:22:3
TS4114: Thismembermusthavean'override'modifierbecauseitoverridesamemberinthebaseclass'Component<IProps, IState, any>'.20|IState21|>{>22|state: IState={}|^^^^^23|24|render(){ERRORinsrc/SomeComponent/index.tsx:24:3
TS4114: Thismembermusthavean'override'modifierbecauseitoverridesamemberinthebaseclass'Component<IProps, IState, any>'.22|state: IState={}23|>24|render(){|^^^^^^25|return( |

Related #38905 , #9034
Fixes#2000
This pr added the
overridekeyword to mark the class method is overrides a method in the base class.And a flag called
noImplicitOverrideand don't break something.Basically, If the flag turns on, We add the below check.
used without
noImplicitOverrideflag: ok but less checkIf a class member has override modifier and the container class does not extend any class: error
if a class member has override modifier and the name of the method is not existed in the base class: error
if a class member do not has override modifier and the name of the method is exited in the base class: error
properties are the same as the method.
node in ambient context: not check.
must before accessibility modifier
cannot be used with the
declarestaticmodifier.cannot be used with a constructor.
Something needs to consider:
class declaration in Ambient context. Should we issue errors in the d.ts files?As Suggestion Backlog Slog, 6/8/2016 #9034 said. Looks needn't.abstract method or abstract class:
eg:
eg: