WickyNilliams / cally

Small, feature-rich calendar components
https://wicky.nillia.ms/cally/
MIT License
1.06k stars 12 forks source link

Fix onRangestart and onRangeend Events in Cally Library #47

Closed Cata1989 closed 1 month ago

Cata1989 commented 1 month ago

The onRangestart and onRangeend events in the Cally library do not always function correctly. To avoid ESLint complaints in StencilJS, the following rules need to be added:

// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error onRangestart={this.handleCalendarRangestart} onRangeend={this.handleCalendarRangeend}

Please fix these event issues or consider changing the event handling mechanism to improve reliability and performance.

WickyNilliams commented 1 month ago

do not always function correctly

in what way?

avoid ESLint complaints

what is it complaining about?

consider changing the event handling mechanism

it uses standard events, there's nothing that can be changed

endv-bogdanb commented 1 month ago

Hi, the issue is the name of the events onRangeStart / onRangeEnd are not recognised if attached to <calendar-range>. Can you rename them in the types to onRangestart / onRangeend.

Currently we are using exported interfaces to enhance our jsx

image
WickyNilliams commented 1 month ago

Oh it's a typescript issue? You can probably get away with mapping the types yourself:

type MapEventName<T> = T extends `on${infer Rest}`
  ? `on${Capitalize<Lowercase<Rest>>}`
  : T;

type MapEvents<T> = {
  [K in keyof T as MapEventName<K>]: T[K];
};

type MappedRangeProps = MapEvents<CalendarRangeProps>
WickyNilliams commented 1 month ago

Closing for now, as I think the above will solve your issues