Added function typeOf

  Used also in testsuite.
Merge branch 'master' into dev