Add a type_id intrinsic

Closes #9913