Przeglądaj źródła

improve typedefs

Adam Shaw 8 lat temu
rodzic
commit
9220884481
2 zmienionych plików z 10 dodań i 4 usunięć
  1. 5 1
      src/exports.ts
  2. 5 3
      src/types/input-types.ts

+ 5 - 1
src/exports.ts

@@ -6,7 +6,11 @@ export const version = '<%= version %>'
 // and the below integer should be incremented.
 export const internalApiVersion = 12
 
-export { EventObjectInput, BusinessHoursInput } from './types/input-types'
+export {
+  EventObjectInput,
+  BusinessHoursInput,
+  EventOptionsBase
+} from './types/input-types'
 
 export {
   applyAll,

+ 5 - 3
src/types/input-types.ts

@@ -15,6 +15,8 @@ export interface RangeInput {
   end?: MomentInput
 }
 
+export type ConstraintInput = RangeInput | BusinessHoursInput | 'businessHours'
+
 export interface EventOptionsBase {
   className?: string | string[]
   editable?: boolean
@@ -22,7 +24,7 @@ export interface EventOptionsBase {
   durationEditable?: boolean
   rendering?: string
   overlap?: boolean
-  constraint?: RangeInput | BusinessHoursInput
+  constraint?: ConstraintInput
   color?: string
   backgroundColor?: string
   borderColor?: string
@@ -183,7 +185,7 @@ export interface OptionsInputBase {
   unselectAuto?: boolean
   unselectCancel?: string
   selectOverlap?: boolean | ((event: EventObjectInput) => boolean)
-  selectConstraint?: RangeInput | BusinessHoursInput
+  selectConstraint?: ConstraintInput
   events?: EventSourceInput
   eventSources?: EventSourceInput[]
   allDayDefault?: boolean
@@ -204,7 +206,7 @@ export interface OptionsInputBase {
   dragOpacity?: number
   dragScroll?: boolean
   eventOverlap?: boolean | ((stillEvent: EventObjectInput, movingEvent: EventObjectInput) => boolean)
-  eventConstraint?: 'businessHours' | BusinessHoursInput | RangeInput
+  eventConstraint?: ConstraintInput
   eventAllow?: ((dropInfo: DropInfo, draggedEvent: Event) => boolean)
   longPressDelay?: number
   eventLongPressDelay?: number