vue-final / vue-final-modal

🍕Vue Final Modal is a tiny, renderless, mobile-friendly, feature-rich modal component for Vue.js.
https://vue-final-modal.org
MIT License
862 stars 95 forks source link

Possibly breaking change on last version update #416

Closed dariogliendo closed 6 months ago

dariogliendo commented 7 months ago

Version

vue-final-modal: v4.5.0 vue: stable

OS

Windows

Steps to reproduce

On code using the "onBeforeOpen" event, when upgrading to version 4.5.0, application is now broken

What is Expected?

The version upgrade to be non-breaking

What is actually happening?

We have made a helper using vue-final-modal, it has remained stable for around 9 months, on verison upgrade to v4.5.0, now build fails with error

error TS2322: Type '{ escToClose: boolean | undefined; overlayTransition: "vfm-fade"; contentTransition: "vfm-fade" | "vfm-slide-right"; contentClass: string; onBeforeOpen: (() => any) | undefined; onOpen: (() => any) | undefined; onBeforeClose(): void; onClose: (() => any) | undefined; }' is not assignable to type 'Partial<{ readonly teleportTo: string | false | RendererElement | null; readonly modalId: ModalId; readonly modelValue: boolean; readonly displayDirective: "show" | "if" | "visible"; ... 18 more ...; readonly preventNavigationGestures: boolean; }> & Omit<...>'.
  Object literal may only specify known properties, but 'onOpen' does not exist in type 'Partial<{ readonly teleportTo: string | false | RendererElement | null; readonly modalId: ModalId; readonly modelValue: boolean; readonly displayDirective: "show" | "if" | "visible"; ... 18 more ...; readonly preventNavigationGestures: boolean; }> & Omit<...>'. Did you mean to write 'onOpened'?

We immediatly fixed the build error by downgrading to previous version and are now working on a fix on the type error to go back to stable version. Just reporting to make devs aware of a possibly breaking change on the latest verion.

hunterliu1003 commented 7 months ago

@dariogliendo Thank you for your report. https://vue-final-modal.org/api/components/vue-final-modal#events I think this is a small feature #367, I didn't consider that the type change would be the breaking change. I will be more cautious when release a new version in the future