beizhedenglong/vue-hooks-form

Misc. TypeScript/Dpcumentation issues

Closed this issue · 2 comments

oyed commented

I've been using the library and love it (Great job!)

However there are a couple issues I've found with using TypeScript (Especially with Volar for VSCode, since now <template> syntax is included in type checking):

field.ref typing incorrect for use-case(?)

Error:

Vue 3 is expecting the following type for :ref bindings:

declare type VNodeRef = string | Ref | ((ref: object | null, refs: Record<string, any>) => void);

Error binding example incorrect(?)

Given the documentation for error handling:

<p v-if="password.error">{{ password.error.message }}</p>

This is erroring, since the error property is an Array - not sure if the typings are wrong, or the intended functionality

Do you want to fix these issues?

password.error is undefined or object, can you give me an example that indicate it an array?
by the way you can use !! to force it into boolean

<p v-if="!!password.error">{{ password.error.message }}</p>