Files
gridpilot.gg/apps/website/lib/contracts/view-data/ViewData.ts
2026-01-24 01:22:43 +01:00

25 lines
604 B
TypeScript

/**
* Base interface for ViewData objects
*
* All ViewData must be JSON-serializable for SSR.
* This type ensures no class instances or functions are included.
*
* Uncle Bob says: "Data structures should not have behavior."
* ViewData is a dumb container for primitives and nested JSON only.
*/
export interface ViewData {
[key: string]: any;
}
/**
* Helper type to ensure a type is ViewData-compatible
*
* Usage:
* ```typescript
* type MyViewData = ViewData & {
* title: string;
* count: number;
* items: string[];
* };
* ```
*/
export type ViewDataOf<T extends ViewData> = T;