Add Category interface to $lib/entities.ts

This commit is contained in:
qowevisa 2024-11-11 22:30:03 +02:00
parent 92c63ce290
commit 4ea0d443f9

View File

@ -20,13 +20,24 @@ export interface Card {
name: string;
}
export interface Category {
id: number;
name: string;
parent_id: number;
}
export const EntityTypes = {
card: "Card",
type: "Type"
type: "Type",
category: "Category",
} as const;
export type EntityName = keyof typeof EntityTypes;
export type EntityType<T extends EntityName> = T extends "card" ? Card : Type;
export type EntityType<T extends EntityName> =
T extends "card" ? Card :
T extends "type" ? Type :
T extends "category" ? Category :
never;
//
// }}}