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

TypeScript does not work as intended #1130

Closed
3 tasks done
vstrimaitis opened this issue Feb 28, 2019 · 1 comment
Closed
3 tasks done

TypeScript does not work as intended #1130

vstrimaitis opened this issue Feb 28, 2019 · 1 comment

Comments

@vstrimaitis
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.16.2
  • VS Code version: 1.31.1
  • TypeScript version: 3.3.1

Problem

When I use TypeScript inside the script tag of a SFC, TypeScript support does not seem to work as intended. Two concrete examples:

  • Unused values (imports, variables) cause an error instead of a warning. Also, the error cannot be automatically fixed (whereas the warning can):
    • Expected behaviour (also note that these can be auto-fixed):
      Expected behaviour
    • Actual behaviour:
      Actual behaviour
  • Renaming symbols does not work (it does work in an identical pure TS example).

Reproducible Case

  1. Setup the project like this:
    $ vue create vetur-ts-bug-example
    
    Vue CLI v3.4.1
    ? Please pick a preset: Manually select features
    ? Check the features needed for your project: Babel, TS, CSS Pre-processors, Linter
    ? Use class-style component syntax? Yes
    ? Use Babel alongside TypeScript for auto-detected polyfills? Yes
    ? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS (with node-sass)
    ? Pick a linter / formatter config: TSLint
    ? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection)Lint on save
    ? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files
    ? Save this as a preset for future projects? (y/N) No
    
  2. Add Prop (or some other unused import) to the imports list.
  3. Add "noUnusedLocals": true to tsconfig.json
  4. Copy the script part from src/App.vue to src/App2.ts

I also created a repository with the steps already executed: https://github.com/vstrimaitis/vetur-ts-bug-example.

This example should show that everything works as expected in the App2.ts file, but not in the App.vue file.

@octref
Copy link
Member

octref commented Mar 21, 2019

With #682 (done) #1163 (not done), #1063 becomes possible (show unused).

#97 is for rename support.

Thanks for the good repro. I'll definitely come back to this issue when I'l fixing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants