Closed ttsimon closed 3 weeks ago
I don't get what the problem here actually is? A type error or what?
The onNodesInitialized event was passed while using the
<VueFlow
onNodesInitialized={() => {
layoutGraph('LR')
}}
>
</VueFlow>
This is an exception message
error TS2322: Type '{ ref: Ref<any>; nodes: { id: string; type: string; label: any; position: { x: number; y: number; }; data: { label: any; envntId?: any; type: string; meta: any[]; }; }[]; edges: any[]; "v-slots": { 'node-custom': (node: any) => Element; }; onNodesInitialized: () => { ...; }; }' is not assignable to type 'IntrinsicAttributes & Partial<{ connectionLineStyle: CSSProperties; connectionLineOptions: ConnectionLineOptions; isValidConnection: ValidConnectionFunc; ... 28 more ...; autoPanOnNodeDrag: boolean; }> & Omit<...>'.
Property 'onNodesInitialized' does not exist on type 'IntrinsicAttributes & Partial<{ connectionLineStyle: CSSProperties; connectionLineOptions: ConnectionLineOptions; isValidConnection: ValidConnectionFunc; ... 28 more ...; autoPanOnNodeDrag: boolean; }> & Omit<...>'.
750 onNodesInitialized={() => {
~~~~~~~~~~~~~~~~~~
I think the reason for the problem is that the
I have tried to fix this problem, but there is no good solution, so I need your help
node: 16.20.2 vue: 3.3.11 vue-tsc: 1.8.25 @vue-flow/core: 1.39.3
Although you can use @ts-ignore to skip the check, I don't think that's a good idea
Can you provide a proper reproduction of this issue, please? You can find a sandbox template here.
Ah I can see the problem myself now, thanks for reporting. Will see what I can do about this issue since it's been recurring for some reason 🥲
Will be fixed in the next patch.
Thanks and I look forward to the next update
Should be fixed with 1.40.0
Is there an existing issue for this?
Current Behavior
An error occurred when I performed the test using vue-tsc, passing the onNodesInitialized event on the VueFlow component, indicating that I was not type-compatible I found that the type definition of the event was missing from the exported vue component type DfineComponent type in @vue-flow/core/dist/container/VueFlow/VueFlow.vue.d.ts
Expected Behavior
No error should be triggered.
Steps To Reproduce
I didn't actually have any code to reproduce, just executed vue-tsc in a project that used VueFlow
Relevant log output
Anything else?
I cloned the source code to try to fix the problem, and I found the possibility problem: I changed the definition of interface FlowEmits to:
Because there are so many properties defined in FlowEmits, there is still no definition for emits, but when I comment out about ten, it works fine
But this is still not enough, I have no other plan, I hope to get your help thank you