How to specify a Moment.js object annotation in Flow : <p>I'm currently learning Flow by applying it to an existing project and looking to annotate function parameters as a Moment.JS objects. </p>

<p>Using <a href="https://github.com/flowtype/flow-typed/" rel="noreferrer">flow-typed</a> I was able to install a library definition for Moment.JS which appears to have the type I'm looking for:</p>

<pre><code>declare class moment$Moment {
  static ISO_8601: string;
  static (string?: string, format?: string|Array&lt;string&gt;, locale?: string, strict?: bool): moment$Moment;
  static (initDate: ?Object|number|Date|Array&lt;number&gt;|moment$Moment|string): moment$Moment;
  static unix(seconds: number): moment$Moment;
  static utc(): moment$Moment;
  ...
</code></pre>

<p>However when I try to annotate function parameters as Moment.JS objects, Flow fails to recognize them as such. In the following function <code>startDate</code> and <code>endDate</code> are Moment.JS date objects.</p>

<pre><code>const filterByDateWhereClause = (startDate: Moment, endDate: Moment): string =&gt; {...};
</code></pre>

<p>Flow gives the following error:</p>

<pre><code>const filterByDateWhereClause = (startDate: Moment, endDate: Moment): string =&gt;
                                                 ^^^^^^ identifier `Moment`. Could not resolve name
</code></pre>

<p>Is this even possible with Flow? Or do I need to duplicate the <code>type</code> for the Moment.JS object identical to the one in the library definition provided by flow-type? I'd prefer not to do this as the libdef is fairly lengthy. </p>

<p>For example:</p>

<pre><code>declare class Moment {
  static ISO_8601: string;
  static (string?: string, format?: string|Array&lt;string&gt;, locale?: string, strict?: bool): moment$Moment;
  static (initDate: ?Object|number|Date|Array&lt;number&gt;|moment$Moment|string): moment$Moment;
  static unix(seconds: number): moment$Moment;
  static utc(): moment$Moment;
  ...

const filterByDateWhereClause = (startDate: Moment, endDate: Moment): string =&gt; {...};
</code></pre>

<p>What am I missing?</p>
