Skip to content
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

[useValidation] Add support for getters for value in useValidation. #418

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

collincchoy
Copy link
Contributor

No description provided.

@collincchoy collincchoy requested a review from a team as a code owner April 2, 2024 19:52
export function useValidation<T>(
value: MaybeRef<T>,
value: MaybeRefOrGetter<T>,
nameOrRules: MaybeRef<string> | RulesArg<NoInfer<T>>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into trying to make name be passable via a getter as well, but it gets more complicated trying to distinguish between a rule (which can be a function) and a getter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah probably not worth it right now.

@@ -77,7 +77,7 @@ export function useValidation<T>(
throw new Error('Invalid useValidation arguments')
}

const valueRef = ref(value) as Ref<T>
const valueRef = toRef(value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ayyy nice got rid of an as

export function useValidation<T>(
value: MaybeRef<T>,
value: MaybeRefOrGetter<T>,
nameOrRules: MaybeRef<string> | RulesArg<NoInfer<T>>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah probably not worth it right now.

@collincchoy collincchoy merged commit 48fb335 into main Apr 2, 2024
3 checks passed
@collincchoy collincchoy deleted the use-validation--getters branch April 2, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants