The script lang=ts showing misleading errors in .vue files
See original GitHub issueInfo
- Platform: Win
- Vetur version: 0.22.2
- VS Code version: 1.38.1
Problem
Reproducible Case
Try vue js ts project from scratch using @vue/cli
with option typescript and check whether vetur <script lang="ts">
is properly validating model properties, vuex getters and actions.
Also my tsconfig.json looks like this:
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"allowJs": false,
"baseUrl": ".",
"types": ["webpack-env", "jest"],
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
"exclude": ["node_modules"]
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
TypeScript errors when editing old Vue 3 components but not ...
I was able to fix these import errors by upgrading TypeScript from 3.9.3 to 4.4.4: npm install typescript@latest. It seems that Vue 3.2.0 ......
Read more >I can't figure out how to get TypeScript checking on <script ...
I'm looking to get the error reported in the yarn serve output like other typescript errors are (seemingly everywhere except <script setup lang= ......
Read more >Vue.js+TypeScript: wrong compiler errors when accesing ...
Vue.js+TypeScript: wrong compiler errors when accesing inherited properties ... <script lang="ts"> import { Component, Prop, Vue } from ...
Read more >♂️ ♀️ Vue 3 error with using TypeScript: property X does ...
When I run vue-tsc --noEmit to check TypeScript, I get errors: ... <script lang="ts"> import { defineComponent } from 'vue' export default ...
Read more >How to use Vue 3 with TypeScript - LogRocket Blog
For each item below, I'll show both the TypeScript and JavaScript-equivalent ... //src/App.vue //Typescript code <script lang="ts"> import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When using
lang="ts"
, you should useexport default Vue.extend({...})
. Otherwise the error checking might not be accurate.Or just stop using bullshit like Vuex which encourages you to use magic strings to access a getter of a store. Go for MobX.
And even better: Stop using VueJS. It’s just garbage.