-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
The prop 'hasError' generates a TS error, types that are generated based on the docs are incorrect #11510
Comments
You can use the return values of And the best way to approach this use case is instead of a regular form, using QForm. That way, you can call validate on the q-form ref, and it will give you the validation result of the whole form. So, instead of dealing with all the input refs, calling validate on them, etc. you can have a single place where you manage them all. But, let's say you had a proper case that definitely needed to access |
Hey @yusufkandemir Thank you so much for the comment, your guide and the information will help me for sure... Thanks a lot! 🙏 Then for me it seemed there are no other ways because I'm just starting with quasar and I'm just reading the docs! also when I brought up my problem inside the quasar discord server, the only person that replied to me, told me that
With what I said I also mention that I'm really newbie and I'm just a document reader with no background about what really happens behind the scene for now, so I hope I'm not wrong about this issue? If I'm wrong let me know please because with what you said
I have to close the issue. I'm so grateful for the response, your hard works and efforts to make the quasar and it's community better. |
Thanks for the kind comment, I appreciate it. I totally understand you and agree that this is confusing. Generally, if something is confusing like this, it might end up being a private thing accidentally used somewhere, or just got overlooked with less to no documentation at all. So, I didn't close the issue because we will evaluate this, and you don't have to close it. |
hasError is still needed @yusufkandemir |
To chime in on this: Sometimes you don't want to use |
Fix will be available in Quasar v2.8 |
First of all I deeply apologize for my bad English. I wanted to use the internal validation from quasar and my code is below this text also what I've learned is from the docs here :
https://quasar.dev/vue-components/input#example--form-validation
But The prop 'hasError' (that is used for internal validation on inputRef and it gives 'true' if the inputs has error) generates a TS error that says
Property 'hasError' does not exist on type QInput
and I guess there is a problem with the types that are generated based on the docs.As you can see in the simple code below, I have to use a // @ts-expect-error because the code
inuputRef.value?.hasError
generates an error and it also gives me what I wanted for validations at the same time.the TS error says :
Property 'hasError' does not exist on type QInput
but the code is correct and the property 'hasError' does exist on type QInput and it's just the TS types that are generated based on the docs and they are incorrect I guess.
Thanks in advance 🙏
My example code that shows the problem but first remove the // @ts-expect-error from it :
The text was updated successfully, but these errors were encountered: