Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt 3 ignores TypeScript errors when saving the code

I have a problem. When there is a TypeScript error in the code, there is an error in the IDE, but I anyways can save it and run in the browser. Is it okay?

Here is the code:

<script lang="ts" setup>
const a = ref<string>(5);
</script>

I tried export default and export default defineComponent(), but it didn't help.

Here is the screenshoot of my IDE You can see the error, but Nuxt.js just updates without any problem.

like image 318
Oleksandr Guman Avatar asked Sep 15 '25 09:09

Oleksandr Guman


1 Answers

As stated on the nuxt 3 documentation typescript/type-checking:

By default, Nuxt doesn't check types when you run nuxi dev or nuxi build, for performance reasons.

If you want to enable it, you need to:

  • install vue-tsc and typescript as devDependencies
  • add this in your nuxt.config.js:
typescript: {
  typeCheck: true,
}
like image 61
Kapcash Avatar answered Sep 17 '25 05:09

Kapcash