feat(types): add type TemplateRef#12645
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? |
jh-leong
left a comment
There was a problem hiding this comment.
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