title: typescript: instanceof not working with immutable.js types
body: <p>We are trying to update our project from typescript2.4 to typescript3.2. We stumbled upon the following problem with immutable.js.</p>
  
  <p>Previously just using <code>if(x instanceof Immutable.Iterable)</code> meant that in the <code>if</code> block the type of <code>x</code> was <code>Immutable.Iterable&lt;any, any&gt;</code>. However, after updating typescript, the inferred type of x is <code>{}</code>.</p>
  
  <p>Code snippet</p>
  
  <p><a href="https://i.stack.imgur.com/So3re.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/So3re.png" alt="enter image description here"></a></p>
  
  <p>Wrong type inferrence</p>
  
  <p><a href="https://i.stack.imgur.com/RGzCp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RGzCp.png" alt="enter image description here"></a></p>
  
  <p>It would be really nasty to fix all the errors by using <code>x as Immutable.Iterable&lt;any, any&gt;</code>.</p>
  
  <p>I guess the problem lies with immutable.js because any other types are inferred correctly in the <code>if</code> block.</p>
  
  <p>P.S. I know about the fact that <code>instanceof</code> is not always trustworthy (<a href="https://github.com/facebook/immutable-js/issues/450#issuecomment-107238770" rel="nofollow noreferrer">https://github.com/facebook/immutable-js/issues/450#issuecomment-107238770</a>) but using <code>Immutable.Iterable.isIterable()</code> doesn't provide the type support that we need (since the variable is still of type <code>any</code>).</p>