ValidationRule typescript error #11854
Labels
area/typescript
bug/2-confirmed
We have reproduce the problem and confirmed that this is a bug.
Qv2 🔝
Quasar v2 issues
I added promise as a validation rule on q-input and type check returns error:
Type '(((val: string) => string | true) | ((val: string) => Promise<string | boolean>))[]' is not assignable to type 'ValidationRule<any>[]'. Type '((val: string) => string | true) | ((val: string) => Promise<string | boolean>)' is not assignable to type 'ValidationRule<any>'. Type '(val: string) => Promise<string | boolean>' is not assignable to type 'ValidationRule<any>'. Type '(val: string) => Promise<string | boolean>' is not assignable to type '(value: any) => string | boolean'. Type 'Promise<string | boolean>' is not assignable to type 'string | boolean'. Type 'Promise<string | boolean>' is not assignable to type 'true'.
In my opinion type definition is missing a Promise:
quasar/ui/types/api/validation.d.ts
Line 4 in 9579815
Documentation mentions that Promise as a rule is possible: https://quasar.dev/vue-components/input#example--async-rules
Is this a thing or am I missing something?
Quasar Version: 2.4.1
Quasar mode:
Additonal Info:
<script setup>
Tested on:
OS: Linux
Browsers: Electron
The text was updated successfully, but these errors were encountered: