I'm loading a third-party library called sorted-array and using it like this:
import SortedArray from 'sorted-array';
export class Selector {
private mySortedArray!: SortedArray;
constructor() {
this.mySortedArray = new SortedArray();
}
}
However, I get this error: Cannot use namespace 'SortedArray' as a type.ts(2709)
So, I created this file:
// src/typings/sorted-array/index.d.ts
declare module 'sorted-array' {
class SortedArray {
constructor(arr: number[]);
search(element: any): number;
}
}
However, the error remains. What am I doing wrong?