You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// @noImplicitOverride: truedeclareclassBase{b: number;}declareclassDerivedextendsBase{b: number;// no error}declareclassBase2{}declareclassDerived2extendsBase2{overrideb: number;// error}
π Actual behavior
A property in a derived class in ambient context doesn't have to have override modifier with noImplicitOverride. override is still checked when present though.
π Expected behavior
It feels slightly inconsistent. I couldn't find any note about this in the docs and I had to look into the source code and dig up the PR that implemented override to check if it's a bug or not.
Additional information about the issue
I believe this works like that since noImplicitOverride was introduced in #39669 in 4.3: TS playground
The text was updated successfully, but these errors were encountered:
- Should this apply to declaration files?
- Argument for yes: correctness for the same reason
- Argument for no: convenience, no need to mess with declaration emitter
- If no: Declaration emitter will need to emit `override` modifier (same way `any` works) if one was not present explicitly
- Decision: Not enforced
π Search Terms
override ambient type declaration class dts noImplicitOverride
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?noImplicitOverride=true&ts=5.8.0-dev.20241128&ssl=15&ssc=2&pln=1&pc=1#code/PTAEAEDsHsEkFsAOAbAlgY1QFwPIDcBTAJyNQBMCAuULIgVwIChGL1kBDIg0N9gZz6gAQv24BvRqFAAjapDrxpxANyMAvs1YcuPDgNAARYqkJlQBAB5YCkMoJF9xkmXIVKiqjSwK8dvfQ4EAEygYl5anNz+gkakpiGW1rb2oiESUtCEJOTcsqDyiirqjEA
π» Code
π Actual behavior
A property in a derived class in ambient context doesn't have to have
override
modifier withnoImplicitOverride
.override
is still checked when present though.π Expected behavior
It feels slightly inconsistent. I couldn't find any note about this in the docs and I had to look into the source code and dig up the PR that implemented
override
to check if it's a bug or not.Additional information about the issue
I believe this works like that since
noImplicitOverride
was introduced in #39669 in 4.3: TS playgroundThe text was updated successfully, but these errors were encountered: