fork-ts-checker-webpack-plugin icon indicating copy to clipboard operation
fork-ts-checker-webpack-plugin copied to clipboard

Vue SFC TS check was broken on vue2.7

Open iceprosurface opened this issue 2 years ago • 0 comments

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';
image

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

Environment

iceprosurface avatar Jul 19 '22 03:07 iceprosurface