title: InstanceOf some type from runtime, Scala
body: <p>The idea, is that, for example we got type of some object:</p>
  
  <pre><code>val tm = getTypeTag("String here").tpe
  //&gt; tm: reflect.runtime.universe.Type = java.lang.String
  
  // for example I got another val or var, of some type:
  
  val tmA: Any = "String here"
  //&gt; tmA: Any = String here
  </code></pre>
  
  <p>How to make <code>tmA.InstanceOf(tm)</code> (it is a mnemonic code)? 'Cause <code>tm</code> it is not a type alias, and we cant make <code>InstanceOf[tm]</code> exactly.</p>
  
  <p><strong>EDITED</strong> </p>
  
  <p>there I mean analog function for <code>asIstanceOf</code>, to make a sort of type casting</p>
  
  <p><strong>EDITED2</strong></p>
  
  <p>I'll partly answer my question myself. So if we have <code>TypeTags</code> is is all easy!</p>
  
  <pre><code>def tGet[T](t: TypeTag[T], obj: Any): T = obj.asInstanceOf[T]
  </code></pre>
  
  <p>It is a harder situation if we only got <code>Type</code> and not the whole <code>TypeTag[T]</code>.   </p>