-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
TS: allow strong typing of directive value #998
Labels
Comments
underfin
added a commit
to underfin/vue-next
that referenced
this issue
Apr 21, 2020
yyx990803
pushed a commit
that referenced
this issue
Jun 11, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What problem does this feature solve?
Directive<T>
is generic in the type of target element.It would be nice to have a second generic value (can default to any) for the
binding.value
type.So that this can be written:
Without this, you have to cast
binding.value
explicitely inside the function body.Hopefully this could be used in the future by Vetur to validate proper directive usage in templates.
What does the proposed API look like?
Modify to
Directive<TElement = any, TValue = any>
The text was updated successfully, but these errors were encountered: