You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I create an input with rules, the IDE (VSCode) show me this error: Parameter 'val' implicitly has an 'any' type.ts(7006)
Example: <q-input v-model="model" label="Required Field" :rules="[(val) => (val && val.length > 0) || 'Field is required!']" />
Platform (please complete the following information):
Quasar Version: 2.1.7
@quasar/app Version: 3.1.5
Thanks
The text was updated successfully, but these errors were encountered:
Easy fix is to provide rules as functions instead of inlining them
Currently there's no way for TS to infer the val provided to the rule if you don't specify it manually, current tooling won't allow it but we'll keep an eye on this if in the future it will be possible (we know there's an ongoing effort from the Vue team on this)
Currently rules is any[]. With better type definitions for rules prop(e.g. string | (value: any) => (string | true)), we can get rid of the TS error, because we are going to explicitly type the parameter as any. We still can't infer the correct type as @IlCallo said, but at least we will have better type definitions.
Describe the bug
When I create an input with rules, the IDE (VSCode) show me this error:
Parameter 'val' implicitly has an 'any' type.ts(7006)
Example:
<q-input v-model="model" label="Required Field" :rules="[(val) => (val && val.length > 0) || 'Field is required!']" />
Platform (please complete the following information):
Quasar Version: 2.1.7
@quasar/app Version: 3.1.5
Thanks
The text was updated successfully, but these errors were encountered: