interface initialStateInterface { user: object; age: number; } const initialState = { user: { username: "", email: "" }, age: 0, };
Here I have the interface type assigned to the user which is an object. Is there any way to assign the types to it’s elements?
What I’m trying to do,
user: (username: string,email: string).
Advertisement
Answer
interfate userType { username: string, email: string } interface initialStateInterface { user: userType; age: number; }