Add Category interface to $lib/entities.ts
This commit is contained in:
parent
92c63ce290
commit
4ea0d443f9
|
@ -20,13 +20,24 @@ export interface Card {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Category {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
parent_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
export const EntityTypes = {
|
export const EntityTypes = {
|
||||||
card: "Card",
|
card: "Card",
|
||||||
type: "Type"
|
type: "Type",
|
||||||
|
category: "Category",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type EntityName = keyof typeof EntityTypes;
|
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;
|
||||||
|
|
||||||
//
|
//
|
||||||
// }}}
|
// }}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user