You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are 3~4 modes of writing in vue in regards to expose, however they generate different types in typescript.
In this repo, there are 4 parent and 4 child components, one pair for each writing mode.
Script setup
Setup function
Options API
Composition API with Options API's expose
In each pair, I am having 4 refs in each child component, named ref1, ref2, ref3 and ref4. With ref1 and ref2 being used in template, and returned (if applicable). Also, in the child ref2 and ref4 are being exposed. In the parent component, there is (TS) code trying to reach these 4 refs, however, there are different TS types on each pair of parent/child.
In the first case it is reflected correctly, but in the other cases it is not. In the second case and fourth case, expose is not respected (in TS), and the types are reflecting the return not expose. And in the third case, it is not taken into consideration at all (in TS), and hence every ref is reflected.
Also, there is a different functional (non-TS) behavior in the last case, if it is not valid, you can simply discard it.
What is expected?
Consistency in TS types.
What is actually happening?
Inconsistent types are generated with different modes of Vue.
I am not sure if the first part is for the core repo or https://github.com/vuejs/language-tools, if it is not for the core repo, please let me know and I will create a different issue there
For the second issue, if it is not valid, you can discard that
Vue version
3.4.21
Link to minimal reproduction
https://github.com/ibrahimBeladi/vue-expose
Steps to reproduce
Clone and test.
There are 3~4 modes of writing in vue in regards to
expose
, however they generate different types in typescript.In this repo, there are 4
parent
and 4child
components, one pair for each writing mode.In each pair, I am having 4 refs in each child component, named ref1, ref2, ref3 and ref4. With ref1 and ref2 being used in template, and returned (if applicable). Also, in the child ref2 and ref4 are being exposed. In the parent component, there is (TS) code trying to reach these 4 refs, however, there are different TS types on each pair of parent/child.
In the first case it is reflected correctly, but in the other cases it is not. In the second case and fourth case,
expose
is not respected (in TS), and the types are reflecting thereturn
notexpose
. And in the third case, it is not taken into consideration at all (in TS), and hence every ref is reflected.Also, there is a different functional (non-TS) behavior in the last case, if it is not valid, you can simply discard it.
What is expected?
Consistency in TS types.
What is actually happening?
Inconsistent types are generated with different modes of Vue.
System Info
Any additional comments?
Npm:
The text was updated successfully, but these errors were encountered: