-
-
Notifications
You must be signed in to change notification settings - Fork 417
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 used in 'key' appears as unused #329
Comments
Vue template AST doesn't provide key binding from ForNode so we can't fix it yet. |
Sorry for posting a duplicate! How can I tell Volar to ignore an issue in a template? |
@bartenra you can use |
Is there any changes about this issue in the last year ? Thanks |
@Zehir unfortunately we have nothing can do here, you can open an issue in vue/core repo. |
This actually nowadays works properly in my setup. Unsure if I should close the issue or not given that apparently Zehir still has issues. |
By using a _ prefix to your variables names ? |
No, with the proper names. I just tested the following quickly: <div v-for="[i, layer] of layers" :key="i">
{{ layer }}
</div> and this does not complain. If I remove the key section it properly complains that |
I have 2 project, in one of them I don't have the issue. |
In this case an array of strings.
|
This problem is only happen with |
Aaah right, my bad, the initial PR is quite a while ago, so I hastily assumed that it was for all iterations :D Sorry for the confusion Zehir :) |
Just ran into this. What's weird is Volar actually knows / infers the type of the item in the collection, so it knows its being used, but also doesn't know its being used. <template
v-for="item in value"
:key="item.id"
> In the above, |
Any news since last year ? (still getting the error) |
I think #329 (comment) is still the case. |
Is there a relevant issue for Vue regarding this? It's been nearly 3 years, seems like a long time for an issue to exist, albeit one that just causes problems with static analysis tools. |
This issue is now resolved, doesn't it work for you? @GRyanParoz |
Sorry, I misread the above update. Disregard! |
- fix unit of Public Water System Violations - use `cent_lat` and `cent_long` that have apparently always been in the backend, instead of using turf.js to calc center of mass for label positions - rearrange api funcs a bit - ~move `index` -> `_index` to avoid [this volar issue](vuejs/language-tools#329 - try to make AppMap component more re-usable/generic - remove popup content. replace with slot and make popup content the responsibility of consuming/parent component. - make prop types generic instead of being tied to api functions - tweak feature info popup data handling - move "onMoveEnd" map handler to top level so its debouncing can be cancelled on unmount - remove "map.remove" call because it is already getting called before map mount (and calling it there [throws an error](Leaflet/Leaflet#4806) for some reason... leaflet just doesn't play well with modern web frameworks) - for positioning feature labels, get info right from feature properties field - tweak feature label appearance - move tooltip that shows unit to just one place, the top left legend - move feature popup content to SectionMap page component, with some typing (FeatureInfo) - change logic of when certain stats (total/min/max/avg/etc) show or not - add some util ts types
The below template gives a "'i' is declared but its value is never read." in both volar and vue-tsc.
While the
i
is indeed not used inside the template itself, it is used in the key and can thus not simply be removed.A temporary workaround can be:
The text was updated successfully, but these errors were encountered: