If I send an object like this:
this.someProvider.someFunction({data: myData});
I need to access it with:
someFunction(something: Object) {
console.log(something['data']); // myData
console.log(something.data) // 'Property data does not exist on type Object'
}
But if I declare the object:
var object = {};
object['data'] = myData;
this.someProvider.someFunction(object);
I can access it like:
someFunction(something: Object) {
console.log(something.data) // myData
console.log(something['data']); // myData
}
Why? What is the difference between these two ways of declaring and accessing the properties of an object?