johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

vue-tsc v0.1.5 regression with <component> #34

Closed cexbrayat closed 3 years ago

cexbrayat commented 3 years ago

When using:

  <RouterView v-slot="{ Component }">
    <component :is="Component" />
  </RouterView>

with:

declare module '@vue/runtime-core' {
  interface GlobalComponents {
    RouterLink: typeof RouterLink & {
      __VLS_slots: {
        default: UnwrapRef<ReturnType<typeof useLink>>;
      };
    };
    RouterView: typeof RouterView & {
      __VLS_slots: {
        default: {
          Component: VNode;
          route: RouteLocationNormalized & { href: string };
        };
      };
    };
  }
}

then vue-tsc works perfectly in v0.1.4 but started failing in v0.1.5 with:

$ vue-tsc --noEmit
src/components/HelloWorld.vue:3:6 - error TS2345: Argument of type '{ is: VNode<RendererNode, RendererElement, { [key: string]: any; }>; }' is not assignable to parameter of type '{ is: VNode<RendererNode, RendererElement, { [key: string]: any; }>; } & VNode<RendererNode, RendererElement, { ...; }>'.
  Type '{ is: VNode<RendererNode, RendererElement, { [key: string]: any; }>; }' is missing the following properties from type 'VNode<RendererNode, RendererElement, { [key: string]: any; }>': type, props, key, ref, and 19 more.

3     <component :is="Component" />
       ~~~~~~~~~

This happened on all our Vue 3 projects when bumping to v0.1.5. I made a small repro if that helps https://github.com/cexbrayat/vue-cli-playground/pull/10

Thank you for your work on volar @johnsoncodehk !

johnsoncodehk commented 3 years ago

Fixed 0.1.6, thanks for your report!