I wanna add an object to an array but I don't know how to declare a variable with the return type is Array<object>.
My example:
var obj = {
'Prop name': 'Prop value'
};
document.body.innerHTML = typeof obj; // output: object
var arr: Array<object>; // error message: Cannot find name 'object'
arr.push(obj);
I've tried again with:
var obj: Object = {
'Prop name': 'Prop value'
};
document.body.innerHTML = typeof obj; // output: object
var arr: Array<Object>;
arr.push(obj); // error message: Cannot read property 'push' of undefined
How can I fix the issue?