-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
feat(types): add type TemplateRef #12645
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
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
What's the status with this PR? Can anyone review it? Do I need to add anything? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: these can be simplified.
Co-authored-by: jh-leong <[email protected]>
@Shinigami92 like this: const myRef = useTemplateRef<InstanceType<typeof MyComp>>('myRef') The official documentation recommends implementing it this way. |
@Mrlilili you literally quoted my post where I gave all the context. Why not just read it. |
This adds "just" a type-alias so we can reduce some code when defining a template-ref.
Right now we would need to write code like:
With the change we can reduce that to:
This makes the code also a little bit more easier to read for newcomers to the project.
I use lefthandside types very often because this ensures that what the developer is wanted to receive here instead of just type what is there. A bit like ts eslint explicit-module-boundary-types