| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
TypeScript Bot (@typescript-bot) run dt. |
Sorry, something went wrong.
|
The TypeScript team has xxyy Heya Wenlu Wang (@Kingwl), I've started to run the tarball bundle task on this PR at 37ada55. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Wenlu Wang (@Kingwl), I've started to run the parallelized Definitely Typed test suite on this PR at 37ada55. You can monitor the build here. |
Sorry, something went wrong.
|
Hey Wenlu Wang (@Kingwl), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so: {
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/80234/artifacts?artifactName=tgz&fileId=24EB196251C0700ECE50C8E4EF36FFE41ECC147DC5822099E673D2E05A67AFE302&fileName=/typescript-4.0.0-insiders.20200720.tgz"
}
}
and then running npm install. There is also a playground for this build. |
Sorry, something went wrong.
|
Emmmm.... Need review and feedback |
Sorry, something went wrong.
|
TypeScript Bot (@typescript-bot) pack this. |
Sorry, something went wrong.
|
Heya Wenlu Wang (@Kingwl), I've started to run the tarball bundle task on this PR at 2fd560a. You can monitor the build here. |
Sorry, something went wrong.
|
Hey Wenlu Wang (@Kingwl), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so: {
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/82712/artifacts?artifactName=tgz&fileId=F20A5C267D30CCAF558DD8B90945444BF1ECAF2C9D1D3EF7D1AECB09BA31230402&fileName=/typescript-4.1.0-insiders.20200819.tgz"
}
}
and then running npm install. There is also a playground for this build. |
Sorry, something went wrong.
|
TypeScript Bot (@typescript-bot) pack this. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Daniel Rosenwasser (@DanielRosenwasser) Comparison Report - master..39669
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sorry, something went wrong.
|
The benchmark looks good, at least with the option off. |
Sorry, something went wrong.
|
Daniel Rosenwasser (@DanielRosenwasser) Comparison Report - master..39669
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sorry, something went wrong.
|
Is this expected? For code class Q {
y() {}
}
class T extends Q {
override y() {}
}The nightly playground emits the following JS code "use strict";
class Q {
y() { }
}
class T extends Q {
override y() { }
}which IMO is invalid. Is override y() {} a valid JS class member? |
Sorry, something went wrong.
|
Jack Works (@Jack-Works) Nope. Fixed in #43536. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Daniel Ferreira Monteiro Alves (@danfma) can you give an example? |
Sorry, something went wrong.
|
Yes. On the left side, it's the original code. So, I tried to put the override in the constructor like protected override readonly context... the compiler will complain. We had to use like in the right side to force the compiler to accept the code. |
Sorry, something went wrong.
|
Would we consider to add quickfix for parameter property or allow override in parameter property as Daniel Ferreira Monteiro Alves (@danfma) said.😂 |
Sorry, something went wrong.
|
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! 😬 |
Sorry, something went wrong.
|
Wenlu Wang (@Kingwl) I think we’re going to allow override in the parameter property, but I’m going to run it by the design meeting on Wednesday. |
Sorry, something went wrong.
|
Okay. Looking forward for the good news :XP |
Sorry, something went wrong.
|
I've problems with static fields and override: #43916 |
Sorry, something went wrong.
|
What about methods that implement interface (as opposed to base class) members? |
Sorry, something went wrong.
No plan yet. |
Sorry, something went wrong.
|
Is there a way to apply this to my entire project except to classes that inherit from a particular class (like React.Component, for example)? |
Sorry, something went wrong.
|
Same question/need as Guilherme Simoes (@guilhermesimoes) - getting errors on state and render inside a React.Component is not helpful, but this flag would be very helpful outside of React (class) components. without a way to exclude these (either by name, e.g. state, render, componentDidMount, etc.), or specifically for known React class properties (exceptReact or something), or even maybe include/exclude by directory or file extension (e.g. *.ts but not *.tsx), i can't use --noImplicitOverride in my project, but I have lots of non-React classes I'd love to have this protection apply to. 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: ERROR in src/SomeComponent/index.tsx:22:3
TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Component<IProps, IState, any>'.
20 | IState
21 | > {
> 22 | state: IState = {}
| ^^^^^
23 |
24 | render() {
ERROR in src/SomeComponent/index.tsx:24:3
TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Component<IProps, IState, any>'.
22 | state: IState = {}
23 |
> 24 | render() {
| ^^^^^^
25 | return ( |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Related #38905 , #9034
Fixes #2000
This pr added the override keyword to mark the class method is overrides a method in the base class.
And a flag called noImplicitOverride and don't break something.
Basically, If the flag turns on, We add the below check.
used without noImplicitOverride flag: ok but less check
If 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 declare static modifier.
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: