Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useField object structure #4735

Closed
1 of 5 tasks
tjuambita opened this issue Apr 24, 2024 · 1 comment
Closed
1 of 5 tasks

useField object structure #4735

tjuambita opened this issue Apr 24, 2024 · 1 comment

Comments

@tjuambita
Copy link

What happened?

Not sure if I am using the types here correctly, but I have encountered an issue when upgrading vee-validate.

I am using the useField() name property in my dynamic ID in the template, and it requires me to put .value at the end of it to extract the string value.

Template:

<SomeComponent :id="`${inputField.name.value}`" ... />

Script:

const inputField = useField('validation rules')

The error:
Property 'value' does not exist on type 'MaybeRef<string>'. Did you mean 'valueOf'? Property 'value' does not exist on type 'string'.ts(2551)

The object structure of my useField:

{
... 
name: ComputedRefImpl {
...
value: 'the string I need'
},
value: ComputedRefImpl {dep: undefined, __v_isRef: true, __v_isReadonly: false, getter: ƒ, _setter: ƒ, …}
...
}

Reproduction steps

...

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

NA

Code of Conduct

@logaretm
Copy link
Owner

Wrap it with reactive().

https://vee-validate.logaretm.com/v4/guide/composition-api/caveats#destructing-composable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants