as<T> method

T as<T>()

tries to case S as T and throws an AsTypeError if fails

Implementation

T as<T>() {
  if (this is T) {
    return this as T;
  }
  throw AsTypeError<T, S>();
}