I am new to TypeScript. I understand how to set up an interface for some types (I guess). But can't seem to grasp how the same would work with an Object type?
interface MyProps {
defaultgreeting: 'Hello'
}
interface MyState {
greeting: string
}
class MyApp extends Component<MyProps, MyState> {
constructor(props: any) {
super(props);
this.state: {
greeting: this.props.defaultgreeting
}
}
}
How would I have to set this up for the following state (which requires an Object)?:
this.state: {
greeting: this.props.defaultgreeting,
users: {
name: 'John Doe',
age: 25
}
}