I tried to use TypeScript built-in interface, ArrayLike
, but still got the error message like following:
Error:(12, 11) TS2420: Class 'Point' incorrectly implements interface 'ArrayLike'. Index signature is missing in type 'Point'.
interface ArrayLike<T> {
length: number;
[n: number]: T;
}
class Point implements ArrayLike<number> {
[0]: number = 10;
length: number = 1;
}
How can I solve this problem? (or any workaround?)