-
-
Notifications
You must be signed in to change notification settings - Fork 172
Description
Overview of the problem
Oruga version: [0.8.]
Vuejs version: [3.4.]
With several releases from 0.8.3 untill 0.8.10, we changed our custom useVModel
composable to the Vue native defineModel
implementation for bi-directional properties.
However, there are some issues with defineModel
that prevent us from implementing further type support and enhancements.
Our component documentation process relies entirely on the vue-docgen-api
. On #985 we have already enhanced it with a vue-component-meta
integration, which allows us to use more modern Vue features.
But vue-component-meta
cannot extract definModel
js-doc comments, so we also have to define the property in defineProps
with the js-doc comment ahead as well as in defineEmits
, but also have defineModel
for the implementation purpose.
Actual behavior
Now the problem we have is that Vue has some problems merging the defineProps
with the defineModel
type definition of a property that is typed by a component generic type.
This seems to be an known vue core issue and might be fixed with Vue 3.5 (vuejs/core#10801), but is not quite ready yet (vuejs/core#9652, vuejs/core#9277).
Therefore, I reverted some two-way-binded props with a custom useVModel
composable in #998, which implements the bi-directional behaviour at runtime and is fully dependent on the defineProps
and defineEmits
definitions, instead of the compile-time definModel
macro.
Expected behavior
The type of a property defined in both defineModel
and defineProps
will merge properly when using generic types.
Any bi-directional property should work with generic component types.