Reputation: 1800
export class Dashboard {
checked: Object = {users: false, device: false}
boxClicked(){
if(checked.users){
console.log("clicked users");
}
}
}
Property 'users' does not exist on type 'Object'. Why?
Upvotes: 2
Views: 43
Reputation: 5802
You are saying checked: Object = {users: false, device: false}
which means that only those members defined 'Object' (the interface) will be visible. So you can not just access 'users'.
You should say checked: any = {users: false, device: false}
Upvotes: 3