TypeStrong / fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No errors are reported in vue3

cuihaoweb opened this issue · comments

Current behavior

No errors were detected in vue3

Expected behavior

Report an error in the console

Steps to reproduce the issue

This is used in vue3:

<script setup lang="ts">
const num = ref<string>(0);
const addCount = () => {
    num.value++;
}
</script>

this is webpack.config.js:

new ForkTsCheckerWebpackPlugin({
    typescript: {
        extensions: {
            vue: {
                disable: false,
                compiler: '@vue/compiler-sfc'
            }
        }
    }
}),

num is a string, but ts does not report an error after ++

Issue reproduction repository

Environment

  • "fork-ts-checker-webpack-plugin": ^7.2.13
  • "typescript": ^4.8.4
  • "ts-loader": ^9.4.1
  • "vue": "^3.2.41"

@cuihaoweb I'm sure you have an error in the config.

new ForkTsCheckerWebpackPlugin({
    typescript: {
        extensions: {
            vue: {
                enabled: true,
                compiler: '@vue/compiler-sfc'
            }
        }
    }
}),

disable: false is wrong
enabled: true is correct

I have the same issue with Vue 2.7.14 and my config is (to my understanding) correct:

{
    "async": false,
    "typescript": {
        "enabled": true,
        "extensions": {
            "vue": {
                "enabled": true,
                "compiler": "@vue/compiler-sfc"
            }
        },
        "memoryLimit": 4096,
        "profile": false,
        "diagnosticOptions": {
            "syntactic": true,
            "semantic": true,
            "declaration": false,
            "global": true
        }
    },
    "logger": {
        "infrastructure": "silent"
    }
}

@timonbandit SFC script setup type checking does not work for Vue 3.
https://vuejs.org/api/sfc-script-setup.html
Works only with setup function.
This ticket is a duplicate of:
#772
This issue is currently blocking us from moving forward with esbuild as well.

🎉 This issue has been resolved in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀