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

Recent versions of vue-tsc show "declared but never read" errors (variables used in styles) #1093

Closed
glen-84 opened this issue Mar 21, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@glen-84
Copy link

glen-84 commented Mar 21, 2022

With the latest versions of vue-tsc, I'm seeing errors like this:

src/app/core/layouts/default.vue:302:7 - error TS6133: 'sectionImages' is declared but its value is never read.

302 const sectionImages = computed(() => {
          ~~~~~~~~~~~~~

The styles:

.content {
    background-image: v-bind("sectionImages.logo.image"), v-bind("sectionImages.header.image");
}
@johnsoncodehk
Copy link
Member

Similar to #1089, will look on @vue/compiler-sfc if it has any available API for this.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Mar 21, 2022
@sapphi-red
Copy link
Contributor

(In case you have not found yet) I think it is able to get it from descriptor.cssVars.

@johnsoncodehk
Copy link
Member

@sapphi-red didn't know it! But unfortunately I will need text range instead of text string for mapping. :/

@sapphi-red
Copy link
Contributor

Because the logic is not so complicated, maybe you can just copy and edit this implementation?

I feel it is difficult to use existing implementations to handle these (css to ts things: like css modules) while retrieving text ranges.

@johnsoncodehk
Copy link
Member

@sapphi-red Yes I'm done like your said, but I hope vue can expose parsed css vars and css module classes text range in future version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants