title: How do I get strict type checking on flowtype interfaces to constructor arguments for classes?
body: <p>Is it possible to get stricter compile time checking when using interfaces for arguments  to constructors? The default behavior seems to be too lenient.</p>
  
  <p>For example given the following class:</p>
  
  <pre><code>// @flow
  'use strict';
  
  import type { Bar } from './bar';
  
  export default class Foo {
  
     _bar: Bar;
     _name: string;
  
     constructor (bar: Bar, name: string) {
       this._bar = bar;
       this._name = name;
     }
  }
  </code></pre>
  
  <p>And the following interface defined in another place:</p>
  
  <pre><code>// @flow
  'use strict';
  
  export interface Bar {
    doSomething(someArg: string);
  }
  </code></pre>
  
  <p>If I create an invalid instance of Foo with some kind of primitive type I'll get an error:</p>
  
  <pre><code>// In any of these flowtype checking works and fails because 
  // it knows those things are not Bar.
  
  new Foo('bar', 'someName'); 
  new Foo(1, 'someName');
  new Foo({}, 'someName');
  </code></pre>
  
  <p>But then if I do something silly like this:</p>
  
  <pre><code>new Foo(new Function(), 'someName');
  </code></pre>
  
  <p>flowtype is perfectly happy with this and that sort of defeats the purpose of even having defined an interface in the first place. If I can just pass in any kind of instance object and flowtype doesn't see that what's passed in does not match the interface it should throw an error just like it did for <code>{}</code>.</p>
  
  <p>Is there some configuration I need to change or something I am doing wrong?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I think this may be a bug and have filed an <a href="https://github.com/facebook/flow/issues/2792" rel="nofollow noreferrer">issue</a>.</p>