Unable to use the Javascript plugin 'moment-weekday-calc' in a Node.Js Typescript project.
moment-weekday-calc does not have a typed version.
My code as written in Javascript:
const moment = require('moment');
require('moment-weekday-calc');
const result = moment().dateRangeToDates({
rangeStart,
rangeEnd,
exclusions,
weekdays: [1, 2, 3, 4, 5]
});
Potential Typescript code:
import * as moment from 'moment';
import 'moment-weekday-calc';
const result = moment().dateRangeToDates({
rangeStart,
rangeEnd,
exclusions,
weekdays: [1, 2, 3, 4, 5],
})
Error: Property 'dateRangeToDates' does not exist on type 'Moment'.ts(2339)
I've tried something like declare module 'moment-weekday-calc'
but still no luck and I think moment-weekday-calc is unable to add the new modules to moment.
Thanking you in anticipation.