Export the `toType()` general helper method