class Foo extends Bar – Foo should inherit static methods from Bar
Currently, only prototype methods are inherited:
class Foo {
static x () {
return 42;
}
}
class Bar extends Foo {}
assert.equal( Bar.x(), 42 ); // fails
One way, which TypeScript uses, is a simple for-in
loop. This doesn't work with static accessors though (which Bublé doesn't yet handle anyway – issue incoming). Babel's solution is to use Object.setPrototypeOf(...)
or __proto__
.