I have a library that has type definitions like this:
declare global {
interface Array<T> {
addRange<T>(elements: T[]): void;
aggregate<U>(accumulator: (accum: U, value?: T, index?: number, list?: T[]) => any, initialValue?: U): any;
}
}
This library is then exported to a NPM package, but how do I consume it in another project?
If I try doing:
['a', 'b'].addRange(['c', 'd']);
I get
Property 'addRange' does not exist on type
But I can't just import addRange because they are Array extensions.
How do I import this library so Typescript knows about it?
tsconfig.json? are you using webpack or some other packaging technology?