2
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?

1 Answer 1

3

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}

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome :-) if it solves your problem you can accept this as the answer to let others know this was correct and has been solved ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.