jsonforms
jsonforms copied to clipboard
Incorrect return type for useControl in Vue
Describe the bug
Typescript shows an error when using control.value
: Property 'value' does not exist on type
But the control
is returned as a ComputedRef
object actually.
Expected behavior
control
returns a ComputedRef object.
https://github.com/eclipsesource/jsonforms/blob/d2bf053315be914b1766a62eb6b7681a530a6633/packages/vue/vue/src/jsonFormsCompositions.ts#L169-L172
Perhaps the line 150, 155, and 190 should replace with ComputedRef<R>
https://github.com/eclipsesource/jsonforms/blob/d2bf053315be914b1766a62eb6b7681a530a6633/packages/vue/vue/src/jsonFormsCompositions.ts#L147-L155
Steps to reproduce the issue
- Call functions that call
useControl
inside, e.g.useJsonFormsControl
- Get value by
control.value
- See type error
Screenshots
No response
In which browser are you experiencing the issue?
Brave 1.38.115
Framework
Vue 2
RendererSet
Other (please specify in the Additional context field)
Additional context
No response
I'm unfamiliar with the construct of your listing. You build and return the component within the setup
method?
In general I agree, yes we should use ComputedRef
within the typings to better express the actual return value.
I agree that use of ComputedRef
within the typings will improve Vue integration and DX a lot!
Regarding the construct in the listing, @Cynthiafan is using a render function instead of a <template>
. setup() can also return a render function.