title: Angular 12 (typescript) and moment-precise-range plugin
body: <p>I'm trying to add and use <a href="https://github.com/codebox/moment-precise-range" rel="nofollow noreferrer">Moment Precise Range plugin</a> to use its main function <code>preciseDiff</code>.</p>
  <p>I have Angular 12 project.</p>
  <p>In my package.json I have:</p>
  <pre><code>&quot;moment&quot;: &quot;2.29.4&quot;,
  &quot;moment-precise-range&quot;: &quot;0.2.0&quot;,
  </code></pre>
  <p>Inside component that uses that plugin I have:</p>
  <pre><code>import * as moment from 'moment';
  import 'moment-precise-range';
  
  declare module 'moment' {
    function preciseDiff(start: string | Date | moment.Moment, end: string | Date | 
      moment.Moment, convertToObject?: boolean): any;
  }
  </code></pre>
  <p>Then I call <code>preciseDiff</code> function:</p>
  <pre><code>moment.preciseDiff(endDate, now, true)
  </code></pre>
  <p>The code compiles, but I have this error:</p>
  <blockquote>
  <p>ERROR TypeError: moment__WEBPACK_IMPORTED_MODULE_4__.preciseDiff is
  not a function</p>
  </blockquote>
  <p>I tried solutions from this <a href="https://stackoverflow.com/questions/45379359/correct-es6-import-for-adding-moment-precise-range-plugin/50165432#50165432">Stack Overflow post</a>, but with no luck.
  When I replaced</p>
  <pre><code>import 'moment-precise-range';
  </code></pre>
  <p>with</p>
  <pre><code>import 'moment-precise-range-plugin';
  </code></pre>
  <p>As suggested there, my code even won't compile.</p>
  <blockquote>
  <p>Error: Can't resolve 'moment-precise-range-plugin'</p>
  </blockquote>