I'm trying to convert an object of values coming from Firebase to a typed array of values:
const snapshot = await db.teams().once('value');
const teams: Array<ITeam> = Object.entries(snapshot.val()).map(
([id, { identifier, name }]): ITeam => {
return { identifier, name, id };
}
);
Types are modelled like following:
export interface ITeam extends ITeamEntry {
id: string;
}
export interface ITeamEntry {
identifier: string;
name: string;
}
But I'm getting errors like:
Property 'identifier' does not exist on type 'unknown'.
Property 'name' does not exist on type 'unknown'.
I'm not sure how to fix this.
ILeaguebe a type attribute ofITeam?