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

No type completion in spec.ts files when using <script setup> for SFC #805

Closed
jayEvans89 opened this issue Dec 20, 2021 · 2 comments
Closed
Labels
design limitation enhancement New feature or request

Comments

@jayEvans89
Copy link

jayEvans89 commented Dec 20, 2021

When using the setup syntactic sugar I can't get any variables, methods, computed variables etc to show in the autocomplete/intellisense in my test files. Props are showing correctly and I can get everything working correctly if I use the defineComponent option without the setup attribute.

I am using Volar's Take Over mode and Vue test utils for testing

Reproduction repo can be found here https://github.com/jayEvans89/vue-app-template

@johnsoncodehk
Copy link
Member

This is a design limitation. If expose all script setup variables, we can't got unused variables report.

But before I find a solution, at least I will add an option to switch this behavior.

@johnsoncodehk
Copy link
Member

Please try add vueCompilerOptions.experimentalExposeScriptSetupContext to tsconfig in next version.

// tsconfig.json
{
  // ...
  "vueCompilerOptions": {
    "experimentalExposeScriptSetupContext": true
  }
}

cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Dec 22, 2021
This new option allows a better typechecking of components that expose variables.
See vuejs/language-tools#805

Refs vuejs#972 as this partially fixes it
cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Dec 24, 2021
This new option allows a better typechecking of components that expose variables.
See vuejs/language-tools#805

Refs vuejs#972 as this partially fixes it
cexbrayat added a commit to cexbrayat/vue-test-utils-next that referenced this issue Dec 24, 2021
This new option allows a better typechecking of components that expose variables.
See vuejs/language-tools#805

Refs vuejs#972 as this partially fixes it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design limitation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants