0

I have found many examples of traits and mixins in typescript, but I miss the way to access public trait method inside the class using the trait Is there a way to have compilator valid trait complete implementation?

class A {
  methA() {}
}

class B {
  methB(){}
}

class C extends B { // and things like "use A"
  methC() {
    this.methA()+this.methB()
  }
}
car c = new C
c.methA()+c.methB()==c.methC()

I tried with an ugly Object.assign(this, new A) but TSC doesn't detect it.

Guile
  • 1,473
  • 1
  • 12
  • 20

0 Answers0