Hello i have encountered a problem with interfaces and the way my data works
I have this object that needs types
user: {
UserData,
admin: AdminData
} | null;
export type UserData = Database["public"]["Tables"]["profiles"]["Row"];
export type AdminData = Database["public"]["Tables"]["admins"]["Row"];
The thing is, i cannot set types for the top level data, or at least i dont know how to.
My data is as follows:
{
id: '24020b3d-17ce-449e-846f-db12d6aeacee',
updated_at: '2023-11-15T20:04:08.107+00:00',
username: 'cooldude',
full_name: 'Name Lastname',
avatar_url: '24020b3d-17ce-449e-846f-db12d6aeacee-0.04009886646356353.png',
website: 'www.website.lt',
admin: {
user_id: '24020b3d-17ce-449e-846f-db12d6aeacee',
admin_from: '2023-11-19T16:12:17.945007+00:00',
admin: true
}
}
everything except from admin object is the type UserData, how can i make it work?