`in` operator not working correctly with component instance `exposeProxy`
Vue version
3.2.37
Link to minimal reproduction
https://stackblitz.com/edit/vuejs-issue-repro-in-operator-expose-proxy?file=src%2FApp.vue
Steps to reproduce
- Create a component which uses
expose({...})
in thesetup()
function. - Use this component in another Vue component and use a template ref to access its instance.
- Access
templateRef.value
in the mounted hook.
What is expected?
templateRef.value.$el // should evaluate to the HTML node correctly
'$el' in templateRef.value // should be true
What is actually happening?
templateRef.value.$el // evaluates to the HTML node correctly ✅
'$el' in templateRef.value // is false ❌
System Info
No response
Any additional comments?
I suspect that the exposeProxy
which uses the get()
handler needs to implement the same logic in the Proxy's has()
handler to fallback to checking if the checked property is defined in publicPropertiesMap[key](instance)
.