You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
Actual behaviour:
Renaming symbols does not work (it does work in an identical pure TS example).
Reproducible Case
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
Add Prop (or some other unused import) to the imports list.
Add "noUnusedLocals": true to tsconfig.json
Copy the script part from src/App.vue to src/App2.ts
Info
Problem
When I use TypeScript inside the
script
tag of a SFC, TypeScript support does not seem to work as intended. Two concrete examples:Reproducible Case
Prop
(or some other unused import) to the imports list."noUnusedLocals": true
totsconfig.json
src/App.vue
tosrc/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 theApp.vue
file.The text was updated successfully, but these errors were encountered: