title: How to pass interface implementation to function in google closure javascript library
body: <p>I would like to define an interface and let the implementation on the library user, and make sure, that in some function, the input parameter is an implementation of the given interface. How to do that?</p>
  
  <p>Example:</p>
  
  <pre><code>/**
   * @interface
   */
  var FooInterface = function(){};
  
  /**
   * nothing special
   */
  FooInterface.prototype.bar = function(){};
  
  /**
   * @constructor
   * @implements {FooInterface}
   */
  var Foo = function() { /* hello world */ };
  
  /**
   * @override
   */
  Foo.prototype.bar = function() { /* do something */ };
  
  
  /**
   * ?? How to annotate, that 'foo' is an implementation of FooInterface,
   * but also instance of something else ??
   * @function
   * @param {FooInterface} foo
   */
   var the_function = function(foo) {
       // foo should be actually instance of Foo, but I want to make sure, 
       // it is an implementation of FooInterface
       // how to indicate that?
       foo.bar(); // code continues
   }
  </code></pre>