i have a function that talks to a server. And one of these getting parametes is called "userstate". This userstate is an object. I get from this object this:
userstate = {
'username' = '',
'display-name' = ''
};
How can I make a class of this? I have at the moment this:
extends class Userstate {
username: string;
displayName: string;
constructior() {
this.username = this['username'];
this.displayName = this['display-name'];
}
}
And in my function I do this:
let get_user_stuff = (userstate: Userstate) => {
console.log(userstate.username);
console.log(userstate.displayName);
};
And my console says this:
darky_chan
undefined
I hope you can help me :) Thanks in advance