In my Angular 4.x application, I encountered an issue while trying to import the moment-range package. The official documentation suggests using the following code:
import Moment from 'moment';
import { extendMoment } from 'moment-range';
const moment = extendMoment(Moment);
However, in my application, moment was added using a different method:
import * as Moment from 'moment';
Therefore, I attempted to apply the same approach to include moment-range:
import * as Moment from 'moment';
import * as MomentRange from 'moment-range';
const moment = MomentRange(Moment);
Unfortunately, this resulted in a TypeScript error. Can anyone provide guidance on resolving this issue?
Cannot invoke an expression whose type lacks a call signature.
Type 'typeof "/node_modules/moment-range/dist/moment-range"'
has no compatible call signatures.