To define a type guard, we simply need to define a function whose return type is a type predicate: ts. function isFish ( pet : Fish | Bird ): pet is Fish {.
確定! 回上一頁