这似乎是一个简单的事情,但我不明白...... 这编译: object CanFoo1 {
def foo(): Unit = {
println("Yup, I can foo alright")
}
}
object CanFoo2 {
def foo(): Unit = {
println("And I can foo with the
打字稿是否支持结构类型兼容性的直接测试? C#支持is运营商和类型的表面IsAssignableFrom(object instance) if (foo is SomeType) ...
if (SomeType.IsAssignableFrom(foo)) ...
有没有在打字稿进行这种检查的一些直接的方式或者我有探测所需的每一个成员的? instanceof可能会为手头的情况做,但不尊