Skip to content

Commit 0be1d04

Browse files
Copilothotlong
andcommitted
Address code review feedback - remove type assertions and improve type safety
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent c0b953f commit 0be1d04

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/plugin-calendar-view/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,5 @@ function DayView({ date, events, onEventClick }: DayViewProps) {
502502

503503
export { CalendarView }
504504

505-
// Export renderer to register the component with ObjectUI
505+
// Export renderer for ObjectUI schema integration
506506
export * from './renderer';

packages/plugin-calendar-view/src/renderer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ ComponentRegistry.register('calendar-view',
101101
}
102102
}, [onAction, schema]);
103103

104+
const validView = (schema.view && ['month', 'week', 'day'].includes(schema.view))
105+
? (schema.view as "month" | "week" | "day")
106+
: 'month';
107+
104108
return (
105109
<CalendarView
106-
events={events as any[]}
107-
view={(schema.view as any) || 'month'}
110+
events={events}
111+
view={validView}
108112
currentDate={schema.currentDate ? new Date(schema.currentDate) : undefined}
109113
onEventClick={handleEventClick}
110114
onDateClick={schema.allowCreate || schema.onDateClick ? handleDateClick : undefined}

0 commit comments

Comments
 (0)