Type checking ignores script-setup blocks
See original GitHub issueVersion
5.0.0-beta.4
Reproduction link
Environment info
System:
OS: Linux 5.14 Arch Linux
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Binaries:
Node: 16.10.0 - /usr/bin/node
Yarn: 1.22.4 - ~/.local/bin/yarn
npm: 7.24.1 - /usr/bin/npm
Browsers:
Chrome: Not Found
Firefox: 92.0.1
npmGlobalPackages:
@vue/cli: 5.0.0-beta.4
Steps to reproduce
vue create vue-cli-script-setup-lang-ts-typechecks -bi '{
"useConfigFiles": false,
"plugins": {
"@vue/cli-plugin-typescript": {
"classComponent": false
}
},
"vueVersion": "3"
}'
cd vue-cli-script-setup-lang-ts-typechecks
Add some wrongly typed code. E.g.:
echo '<script setup lang="ts">const x: string = 42;</script>' >> src/App.vue
Build
npm run build
What is expected?
The typescript error is detected and the build fails.
What is actually happening?
The typing is simply stripped and no error can be seen.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (8 by maintainers)
Top Results From Across the Web
VueJs Typescript ignore typescript error in template block
If a typescript error annoys you in a v-if="" , v-model="" , v-for="" etc. in your template block, you can ignore it like...
Read more ><script setup> | Vue.js
<script setup> is a compile-time syntactic sugar for using Composition API inside Single-File Components (SFCs). It is the recommended syntax if you are ......
Read more >Documentation - TypeScript 2.0
In strict null checking mode the compiler requires every reference to a local variable of a type that doesn't include undefined to be...
Read more >Disabling and enabling inspections | PyCharm Documentation
To partly disable an inspection for particular types of files, use the scope settings. Disable inspections. Disable an inspection in the ...
Read more >Ignoring Code - Prettier
A JavaScript comment of // prettier-ignore will exclude the next node in the abstract syntax tree from formatting. For example: matrix( 1, 0,...
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
The first try to solve this in fork-ts-checker-webpack-plugin was reverted and no further attempt has been made afaict. I have switched to vite since and am using vue-tsc there anway. I think vue-tsc also works in vue-cli context as a workaround. Just has to be triggered manually. @victorgarciaesgi
@sodatea This issue and #6736 are related to
fork-ts-checker-webpack-plugin
, ts-checker doesn’t support<script setup>
yet, I’ve submitted an issue and waiting for reply.But think a little further, is it better to create Vue3 project with vue-cli-plugin-vite? Vite can provide long-term support for Vue3.