Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Thousands of TS errors #65

Closed
Shinigami92 opened this issue Aug 30, 2021 · 17 comments
Closed

Thousands of TS errors #65

Shinigami92 opened this issue Aug 30, 2021 · 17 comments
Labels
bug Something isn't working

Comments

@Shinigami92
Copy link

Shinigami92 commented Aug 30, 2021

My companies project uses vue-tsc ~0.3.0 and vscode-vue-languageservice ~0.27.7
Last week everything worked, but today (after weekend) I just run rm yarn.lock && yarn to update all dependencies and now when I run yarn vue-tsc --noEmit I get 3780 TS errors.

They mostly look like TS2304: Cannot find name 'XXX'. or TS2306: File 'XXX' is not a module.

But even when I pin the both deps, I still get these errors.
Only when I reset my yarn.lock and package.json and then run yarn install --immutable then I don't get the errors.

But this or that way, vite dev server shows everything works normally.

@Shinigami92
Copy link
Author

See vuejs/language-tools#437 🤔
Could be related

@johnsoncodehk
Copy link
Owner

Replied, reproduce wanted. :S

@Shinigami92
Copy link
Author

Repro: https://github.com/Shinigami92/repro-vue-tsc-65/commits/master

@Shinigami92
Copy link
Author

I'm down from 3780 TS Errors to "only" 420 TS Errors 😔

There are only mainly two types of errors

  1. Normal variables/functions not found returned by the setup function
    error TS2304: Cannot find name 'xxx'.

  2. v-slot:activator="{ on }"

image

There is also one $t 👀
image


I think I will update the repro and tell you when it's ready

@Shinigami92
Copy link
Author

The second error occurred through tsconfig.json setting noUnusedLocals to true

Setting it to false, I'm down to 327 errors.
Could you fix that? I would like to stay on "noUnusedLocals": true

... Will dig further down for the other errors ...

@johnsoncodehk
Copy link
Owner

Could you fix that? I would like to stay on "noUnusedLocals": true

I think this is correct report, if you have no use { on }.

@Shinigami92
Copy link
Author

I think this is correct report, if you have no use { on }.

But I have... that's the point ^^, otherwise I would remove it


The other errors are really random and I currently don't find out why the occur 🤔

I will update the repro now, but everything in it works...

@Shinigami92
Copy link
Author

Shinigami92 commented Sep 1, 2021

Also before last thursday I didn't had all these issues, then some updates in volar and vue/vscode language server and vue-tsc happend, and after that it broke.
But I also cannot pin versions or so. When I just update something and recreate the yarn.lock after that it's broken. 🙁

I would like to rollback to last thursday...

@johnsoncodehk
Copy link
Owner

I only see the declared but never read problem.

image
image

@Shinigami92
Copy link
Author

I'm away for next hour. Not sure I will come back today, otherwise see you tomorrow 👋

Thx for all your work 💚

@johnsoncodehk
Copy link
Owner

It's because line 7 v-on="{ ...tooltip, ...menu }" don't have event name, so volar ignore this expression. What is the nameless event behavior?

@Shinigami92
Copy link
Author

I have one more step to success! I found out that the issue that all these variables cannot be found is based on one sub-sub component!
This component uses some really special stuff, but seems to crash the parser and therefore cannot be compiled leading to un-compiled code for the components using it traversing up the tree to the root views.
All views/components that has not this component in use anywhere are working just fine.

Now I need to find out what exactly the problem is.

@Shinigami92
Copy link
Author

Shinigami92 commented Sep 2, 2021

It has something to do with following code

v-btn(icon, @click="currentPreviewIndex--", :disabled="currentPreviewIndex <= 0")
//-                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^~~~

But even when I try to reproduce it, it just works
I'm so confused

It took me 2-3 hours to find me this code line

I think my workaround would be for now to move this condition to a computed and then use that
Edit: ... yes the workaround works, no errors anymore

@johnsoncodehk
Copy link
Owner

It seem a pug parser problem, and working good in html. Will check it.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Sep 3, 2021
@johnsoncodehk
Copy link
Owner

We use HTMLDocument from vscode-html-languageservice to parse SFC, it detected <= is a html start tag, so all behind SFC blocks is broken. Don't know how to handle yet. :S

@johnsoncodehk
Copy link
Owner

Please track vuejs/language-tools#451.

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

No branches or pull requests

2 participants