1
super.super.methodName
을 TypeScript로 호출 할 수있는 방법이 있습니까? super.methodName
으로 전화하는 것을 피하고 싶지만 두 번째 조상의 methodName
메서드를 호출하고 싶습니다.TypeScript super.super call
감사합니다.
super.super.methodName
을 TypeScript로 호출 할 수있는 방법이 있습니까? super.methodName
으로 전화하는 것을 피하고 싶지만 두 번째 조상의 methodName
메서드를 호출하고 싶습니다.TypeScript super.super call
감사합니다.
TypeScript에서 지원되지 않습니다. 당신은 그러나 멤버 함수 프로토 타입에 있다는 사실을 악용 할 수 있습니다 할 수 있습니다 this
그래서 SomeBaseClass.prototype.methodName.call(this,/*other args*/)
예와 call
아무것도 :
class Foo{
a(){alert('foo')}
}
class Bar extends Foo{
a(){alert('bar')}
}
class Bas extends Bar{
a(){Foo.prototype.a.call(this);}
}
var bas = new Bas();
bas.a();