title: Typescript inference issue - Return type of exported function has or is using name ... but cannot be named
body: <p>I want to create a function which transform a Promise based function, in my example from <em>mongodb node client</em>, into an Observable.</p>
  
  <p>The code is very simple</p>
  
  <pre><code>export function updateOneObs(filter: Object, object: Object, collection: Collection&lt;any&gt;) {
      return Observable.fromPromise(collection.updateOne(filter, object));
  }
  </code></pre>
  
  <p>If I put this in VSCode, I get an error message that says </p>
  
  <p><em>"Return type of exported function has or is using name 'UpdateWriteOpResult' from external module ".../npm-packages/observable-mongo/node_modules/@types/mongodb/index" but cannot be named."</em></p>
  
  <p>To fix this I need to explicitly import the missing type via</p>
  
  <p><code>import {UpdateWriteOpResult} from 'mongodb';</code></p>
  
  <p>Considering that the error message clearly suggests that Typescript knows where to look for the missing type, is there a way to have resolved via inference without an explicit import?</p>
  
  <p>In my case the import has ad additional small disadvantage: since I have set up the Typescript compiler with <code>"noUnusedLocals": true</code>, once I import the missing type I have to use it somewhere if I want to avoid another error.</p>