What Am I doing wrong in my below code?
I am trying to extend Array on my class MyNumberList and then trying to use it. What I see is that no items seem to be getting added to the list. I get an undefined when I attempt to access the list elements.
P.S I am using TypeScript 1.8.2
class MyNumberList extends Array<number> {
constructor(...numbers: number[]) {
// looks like this is not working
super(...numbers);
}
}
let statusCodes: MyNumberList = new MyNumberList(10, 20, 30);
console.log(statusCodes[0]); // printing undefined
console.log(statusCodes.length); // printing 0