fork-ts-checker-webpack-plugin
fork-ts-checker-webpack-plugin copied to clipboard
Vue SFC TS check was broken on vue2.7
Current behavior
https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/src/typescript/extension/vue/type-script-vue-extension.ts#L113
vue2.7 hit isVueTemplateCompilerV3
,but there is no descriptor
on parsed
const parsed = compiler.parse(vueSourceText);
if (parsed.descriptor && parsed.descriptor.script) {
const scriptV3 = parsed.descriptor.script;
parsed
shows like following codes
{
source: undefined,
filename: 'anonymous.vue',
template: null,
script: null,
scriptSetup: null,
styles: [],
customBlocks: [],
cssVars: [],
errors: [],
shouldForceReload: [Function (anonymous)]
}
So that any ts check on vue will fail.
export { default as FilteredSearchToken } from './FilteredSearchToken.vue';

Error shows:
TS2322: Type '{}' is not assignable to type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, ... 4 more ..., ...>>>'.
Expected behavior
Checker should work fine.
Steps to reproduce the issue
yarn serve
Issue reproduction repository
https://github.com/iceprosurface/vue2.7-tsx-error