Typescript uses interfaces to represent array problems?

interface NumberArray {
    [index: number]: number;
}

let fibonaccio: NumberArray = { 1: 1 };
let fibonacci: NumberArray = [1, 1, 2, 3, 5];

I know that the fibonacci line represents an array of NumberArray interface types, which means that all the elements in the array are NumberArray interface types

my doubt is in , why it is an interface type, and I don"t understand it

Apr.29,2022
The

array can be regarded as {0: 1, 1: 1, 2: 2, 3: 3, 4: 5} array index as key

.
Menu