I have the following snippet to extend underline with sum function
import * as _ from "underscore"
declare module "underscore" {
export interface UnderscoreStatic {
sum(items: number[]): number;
}
}
_.mixin({
sum: items => { return _.reduce<number, number>(items, function (s, x) { return s + x; }, 0); }
});
However, the use of _. sum () gives me the "Property" sum "does not exist in the type" UnderscoreStatic ".
Well, will someone tell me the correct way to do this?
source
share