Looking for guidance on how to properly declare an array of objects using a custom interface in TypeScript. Below is the interface I am working with:
export interface Member {
name: string,
isLoggedIn: boolean,
loginTime: Date
}
I attempted to declare a list of members like so:
public members: Member[] = [
{name: "John"},
{name: "Cena"}
];
However, I encountered this error message:
Type '{ name: string; }[]' is not assignable to type 'Member[]'
Any suggestions on the correct way to declare an array of objects with a custom interface to ensure it works correctly and follows best practices?