diff --git a/types/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index dd87ad3b39..f72745424b 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -27,11 +27,11 @@ export type stringOrDate = string | Date; export type ViewKey = 'MONTH' | 'WEEK' | 'WORK_WEEK' | 'DAY' | 'AGENDA'; export type View = 'month' | 'week' | 'work_week' | 'day' | 'agenda'; export type ViewsProps = View[] | { - work_week?: boolean | React.SFC | React.Component, - day?: boolean | React.SFC | React.Component, - agenda?: boolean | React.SFC | React.Component, - month?: boolean | React.SFC | React.Component, - week?: boolean | React.SFC | React.Component + work_week?: boolean | React.ComponentType & ViewStatic, + day?: boolean | React.ComponentType & ViewStatic, + agenda?: boolean | React.ComponentType & ViewStatic, + month?: boolean | React.ComponentType & ViewStatic, + week?: boolean | React.ComponentType & ViewStatic }; export type NavigateAction = 'PREV' | 'NEXT' | 'TODAY' | 'DATE'; export interface Event { @@ -309,8 +309,15 @@ export interface CalendarProps void; } +export interface TitleOptions { + formats: DateFormat[]; + culture?: string; + [propName: string]: any; +} + export interface ViewStatic { navigate(date: Date, action: NavigateAction, props: any): Date; + title(date: Date, options: TitleOptions): string; } export interface MoveOptions { diff --git a/types/react-big-calendar/react-big-calendar-tests.tsx b/types/react-big-calendar/react-big-calendar-tests.tsx index 1b1263888b..ef42392b10 100644 --- a/types/react-big-calendar/react-big-calendar-tests.tsx +++ b/types/react-big-calendar/react-big-calendar-tests.tsx @@ -119,13 +119,24 @@ class CalendarResource { // overriding 'views' props { - const DaySFC: React.SFC = () => null; + interface DayProps { + random: string; + } + class DayComponent extends React.Component { + static title() { + return 'title'; + } + + static navigate() { + return new Date(); + } + } // supplying object to 'views' prop with only some of the supported views. - // A view can be a boolean or an SFC + // A view can be a boolean or implement title() and navigate() ReactDOM.render(, document.body);