这是具有深层方法S
的类的示例。
class Core {
read = () => true
}
class Customer extends Core {}
class Plan extends Core {}
class S {
stripeCustomer = new Customer()
stripePlan = new Plan()
}
type a = ReturnType<Core['read']> // boolean
type b = ReturnType<S['stripeCustomer']['read']> // boolean
这是我正在寻找的语法:
DeepMethodReturnType<A,B>
type c = DeepMethodReturnType<S,'stripeCustomer.read'>
是否可以使用点表示法访问类的深层方法?像stripeCustomer.read
一样?