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

[Regression] vue-tsc false positive with noUnusedLocals: true #1168

Closed
ahnpnl opened this issue Apr 11, 2022 · 4 comments
Closed

[Regression] vue-tsc false positive with noUnusedLocals: true #1168

ahnpnl opened this issue Apr 11, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@ahnpnl
Copy link
Contributor

ahnpnl commented Apr 11, 2022

Summary

Setting noUnusedLocals: true in tsconfig made vue-tsc produce false positive type check for object destructuring with template accessing via ref.

Reproduce steps

src/App.vue:10:7 - error TS6133: 'helloWorldRef' is declared but its value is never read.

10 const { helloWorldRef } = useTestLogic();

Extra information

This is a regression since 0.34.4

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Apr 11, 2022
@ahnpnl
Copy link
Contributor Author

ahnpnl commented Aug 11, 2022

@johnsoncodehk this bug is back on 0.40.1, this time it occurs to function binding to event, happens to SFC with script setup.

EDITED it actually occurs to any bindings, variables, functions etc...

@johnsoncodehk
Copy link
Member

@ahnpnl I can't reproduce this problem, and the repro seems not exist any more. If you can contribute a test case or provide minimal reproduction it will be helpful.

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Aug 14, 2022

@johnsoncodehk
Copy link
Member

@ahnpnl Just In case you missed it, you can also update tsconfig to avoid this problem in v0.40.1.

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
+    "jsx": "preserve",
    "noEmit": true,
    "strict": true,
    "sourceMap": true,
    "allowJs": true,
    "skipLibCheck": true,
    "useDefineForClassFields": true,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "importsNotUsedAsValues": "error",
    "lib": ["esnext", "dom"],
    "types": ["vite/client"]
  },
-  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx"]
+  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}

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

2 participants