Implement built-in function type-of() (#12776)

Change-Id: I9438268bf8904cf871c5daa7c398e0ccfa581e49