"unsafe member access" errors when using exposed methods from Vue's template ref
s
#240
Open
4 tasks done
ref
s
#240
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.15.0
What version of
eslint-plugin-vue
andvue-eslint-parser
are you using?What did you do?
See the reproduction steps below. Here are the relevant source code files:
App.vue
Modal.vue
The intent is to use the exported functions from an instance of the
Modal
component whenever needed. For that, I use Vue'suseTemplateRef
function and thedefineExpose
compiler macro.While running the lint script, I get the following errors:
Note that there are two functions exported from the
Modal
component, namely,open
andclose
. However, I use these functions differently in theApp
component. Theopen
method is used directly in thetemplate
section, whereas for theclose
function I've created a wrapper of the same name in thescript setup
section. Note that the error of using anany
value is reported only on the wrapper (specifically, on the callmodal.value?.close()
).This issue is also eerily similar to vuejs/core#6882.
What did you expect to happen?
No errors should have been reported.
What actually happened?
The following errors are reported:
Link to Minimal Reproducible Example
https://github.com/paveloom-o/vue-playground/tree/use-template-ref
Additional comments
This issue was moved from vuejs/core#12433 and typescript-eslint/typescript-eslint#10359.
Repro Steps
git clone --branch use-template-ref https://github.com/paveloom-o/vue-playground.git
cd vue-playground
direnv allow
(OPTIONAL: if you havedirenv
andnix-direnv
installed)npm install
npm run lint
The text was updated successfully, but these errors were encountered: