Using typeof in inheritance

Topics: Language Specification
Nov 2, 2013 at 5:51 PM
What is the reason not allowing this ?
class A {}
var a : A;

class B implements typeof a {}
Coordinator
Nov 4, 2013 at 4:50 PM
We currently don't support expressions in the "implements" clause. This was largely just a limitation in our class design to keep it to a reasonable set to reason about, as classes in ES6 did (and I believe still do) support extends clauses that have arbitrary expressions, which was also before we added the 'typeof' keyword. In short, it's partly historical.

After 1.0, as we start incorporating more ES6 features, it would make sense to revisit places where other expressions

That said, what are you trying to do? You can express these as interfaces as well.