Closed
Description
This code:
/* @flow */
class A {
x():A {
return this;
}
}
class B extends A {
y():B {
return this;
}
}
var w = new B();
w.x().y();
Gives this error:
hello.js:17:1,9: call of method y
Property not found in
hello.js:3:7,7: A
How can I express the return type of A.x()
to be the same type as the instance's type where x()
is invoked on?
This is very important for any javascript library that implements a chainable API where elements on the chain may subclass a base class and inherit chainable methods.