Add As<T> for safe casting.