Library of stage-0 JavaScript decorators (aka ES2016/ES7 decorators but not accurate) inspired by languages that come with built-ins like @override, @deprecate, @autobind, @mixin and more. Popular with React/Angular, but is framework agnostic.
MIT License
4.52k
stars
263
forks
source link
Override reports error when not all intermediate classes implement method #156
Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain.
Yet, a syntax error gets thrown when an overridden method does not appear in all ancestors.
SyntaxError: No descriptor matching C#one() was found on the prototype chain.
Did you mean "one"?
class A {
public one() { return 1; }
}
class B extends A {
// Syntax error disappears when the line below is included
// public one() { return super.one(); }
public two(y: number) { return y + this.one(); }
}
class C extends B {
@override
public one() { return 42; }
}
const c = new C();
console.log(c.two(2));
The documentation states:
Yet, a syntax error gets thrown when an overridden method does not appear in all ancestors.
Looks related to #62