language-tools: Type checking fails for components loaded via `defineAsyncComponent`
Vue - Official extension or vue-tsc version
2.1.4
VSCode version
1.92.2
Vue version
2.7.16
TypeScript version
5.5.4
System Info
No response
package.json dependencies
No response
Steps to reproduce
- Import a component via
const Component = defineAsyncComponent(() => import('path/to/Component.vue'))and use it within the template. - Run
vue-tsc --noEmit - Notice the error.
What is expected?
The check passing succesfully.
What is actually happening?
The following TS error:
TS2345: Argument of type '{}' is not assignable to parameter of type '(component: Component<DefaultData<never>, DefaultMethods<never>, DefaultComputed, DefaultProps, {}>) => void'.
Type '{}' provides no match for the signature '(component: Component<DefaultData<never>, DefaultMethods<never>, DefaultComputed, DefaultProps, {}>): void'.
Link to minimal reproduction
No response
Any additional comments?
This issue started happening in 2.1.4, 2.1.2 seems to work fine.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
Commits related to this issue
- fix(language-core): special handling Vue 2.7 async component close #4789 — committed to Superoldman96/language-tools by johnsoncodehk 2 years ago
The current solution is not elegant and may trigger other unexpected type inferences. We are currently unable to merge it into the main branch - please use the above workaround temporarily until then.
Oh my god, I cannot read. I’ve added it before that line and now it works. I apologize for the inconvenience and thank you for the solution.