Description
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...