use type switch to convert types to amf0any.