question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type checking ignores script-setup blocks

See original GitHub issue

Version

5.0.0-beta.4

Reproduction link

github.com

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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bodograumanncommented, Oct 4, 2022

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

1reaction
curly210102commented, Oct 18, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found