[Validation] Allow rule only field
Closed this issue ยท 2 comments
kiaking commented
Currently, useV
can only define keys that exist in the given data. But there are cases where having virtual field only for validation makes sense. Can we make this possible?
const { data } = useD({
firstName: '',
lastName: ''
})
const { validation } = useV(data, {
// This gives type error right now.
fullName: {
require: rule(() => {
return data.value.firstName && data.value.lastName
})
}
})
brc-dd commented
Bit tricky without casting. Maybe just set fullName: undefined
in useD call ๐
kiaking commented
Hmmm yeah make sense ๐ Let's go with that ๐