Adds .d.ts declarations beside the untyped JS modules imported from TS (api.js, navConfig.js, adminSchema.js, adminNav.js, src/data/*), with shapes taken from the server routes and migrations. get/post/ patch/del now return unknown unless the caller names the response. Fixes found along the way: - website/email/instagram are bare strings from splitLinks, not Link objects; OrganizationDetail's website and email pills rendered with no href or label and now link correctly. - The chapter map falls back to FALLBACK_COLOR for a region with no colour instead of painting its tiles black. Adds defineSection() so each page manifest entry's props are checked against its own Component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
760 B
TypeScript
27 lines
760 B
TypeScript
/* Types for eventData.js. Rows are GET /events as shapeEvent in
|
|
server/src/routes/content.js sends them. */
|
|
|
|
import type { EventType } from "../lib/eventTypes.ts";
|
|
import type { EventListItem } from "../lib/useContent.ts";
|
|
|
|
export type EventFilter = {
|
|
section?: string;
|
|
host?: string;
|
|
status?: EventListItem["status"];
|
|
type?: EventType | EventType[];
|
|
};
|
|
|
|
export declare function useEvents(filter?: EventFilter): {
|
|
events: EventListItem[];
|
|
loading: boolean;
|
|
error: Error | null;
|
|
};
|
|
|
|
export declare function splitByStatus<T extends { status: string }>(
|
|
events?: T[],
|
|
): { upcoming: T[]; past: T[] };
|
|
|
|
export declare function typesPresent<D extends { id: string }>(
|
|
events?: Array<{ event_type: string }>,
|
|
declared?: readonly D[],
|
|
): D[];
|