title: Typescript equivalent of decltype in C++?
body: <p><code>decltype</code> in C++ returns the type of an expression, for example <code>decltype(1+1)</code> will be <code>int</code>.</p>
  
  <p>Note that the expression won't be executed or compiled.</p>
  
  <p>Does Typescript has something similar?</p>
  
  <p>Example usecase that i think should work:</p>
  
  <pre><code>const foo = () =&gt; ({a: '', b: 0});
  type foo_return_type = decltype(foo());
  // foo_return_type should be '{a: stirng, b: number}`
  
  import { bar } from './some_module';
  type my_type = decltype(new bar().some_method());
  </code></pre>