Skip to content
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

"[variable] is declared but never used" while it is used in a directive #2588

Closed
mort3za opened this issue Apr 5, 2023 · 3 comments
Closed
Labels
enhancement New feature or request good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first

Comments

@mort3za
Copy link

mort3za commented Apr 5, 2023

In this component:

<template lang="html">
  <button v-track:[trackName].click>my button</button>
</template>
<script setup lang="ts">
const trackName = 'MyButton';
</script>

I get a warning:
'trackName' is declared but its value is never read. ts(6133)

Environment:
VScode latest version.
Vue 2.7
Volar 1.2.0

@johnsoncodehk johnsoncodehk added enhancement New feature or request good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first labels Apr 20, 2023
@robertrosman
Copy link

@johnsoncodehk sorry to reopen this issue, but I think that static arguments broke due to ed863fb. Haven't encountered squiggly lines before on directive arguments, but they appeared a few days ago. Dynamic arguments works just fine though.

<script setup lang="ts">
const arg = 'title'
</script>

<template>
  <h2 v-custom-directive:title>This static argument is yelling at me :(</h2>
  <h2 v-custom-directive:[arg]>Dynamic works just fine :)</h2>
</template>

image

@johnsoncodehk
Copy link
Member

@robertrosman it should be fixed by ded5a0e, you can update to v1.5.1 or later.

@robertrosman
Copy link

Amazing, big thanks @johnsoncodehk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first
Projects
None yet
Development

No branches or pull requests

3 participants