Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly wrong argument type for createElementBlock #4390

Closed
pfumagalli opened this issue Aug 19, 2021 · 3 comments
Closed

Possibly wrong argument type for createElementBlock #4390

pfumagalli opened this issue Aug 19, 2021 · 3 comments

Comments

@pfumagalli
Copy link

https://github.com/vuejs/vue-next/blob/6db15a27cf0040f95b21ccfff86799c021231efc/packages/runtime-core/src/vnode.ts#L289

The definition for createElementBlock reads:

export function createElementBlock(
  type: string,
  props?: Record<string, any> | null,
  children?: any,
  patchFlag?: number,
  dynamicProps?: string[],
  shapeFlag?: number
) { /* ... */ }

However while playing around with compiler-sfc I noticed that when a component has more than one root element (within the <template/> definition the function is passed the Fragment as a type.

Then (obviously) when running TSC over the generated render function, I get a TS2345 error Argument of type '{ new (): { $props: VNodeProps; }; __isFragment: true; }' is not assignable to parameter of type 'string'.

This seems to be also reflected in the tests (e.g. see https://github.com/vuejs/vue-next/blob/ceff89905b05381d3d73c480e08c7aff9271b074/packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap#L17) so I don't know why it doesn't seem to be caught.

I assume the correct type for the type parameter should be VNodeTypes ???

@HcySunYang this was in your #3334...

@vue-bot
Copy link
Contributor

vue-bot commented Aug 19, 2021

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!

@vue-bot vue-bot closed this as completed Aug 19, 2021
@LinusBorg LinusBorg reopened this Aug 19, 2021
@SebastianSpeitel
Copy link

I'm having the same issue and could provide a minimal example if needed.

@posva
Copy link
Member

posva commented Aug 19, 2021

Closing in favor of #4391

@posva posva closed this as completed Aug 19, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants