Skip to content

Conversation

@vBenTec
Copy link

@vBenTec vBenTec commented Sep 8, 2025

This PR adjusts the typing of the parent property in VueDragAndDropData.
Previously, it was defined as:

HTMLElement | Ref<HTMLElement | undefined>

However, in practice we are passing a template ref, which in Vue 3 is typed as a ShallowRef.

Problem

When consuming this interface, TypeScript raises errors because the type does not align with how Vue template refs are defined:

Vue: Type 'ShallowRef<T | null>' is not assignable to type 
'HTMLElement | Ref<HTMLElement | undefined>'
  Type 'ShallowRef<T | null>' is not assignable to type 
  'Ref<HTMLElement | undefined>'

Currently, the workaround is to cast ShallowRef to Ref, but this is misleading and hides the actual usage pattern.

Solution

Update the type definition to reflect Vue’s behavior:

parent: HTMLElement | ShallowRef<HTMLElement | undefined>;

This makes the typing consistent with useTemplateRef and avoids unnecessary type assertions.

Impact

  • Fixes TypeScript mismatches when passing template refs.
  • No runtime changes — this is purely a type-level correction.

@vercel
Copy link

vercel bot commented Sep 8, 2025

@vBenTec is attempting to deploy a commit to the Formkit Team on Vercel.

A member of the Team first needs to authorize it.

@vBenTec
Copy link
Author

vBenTec commented Sep 8, 2025

Duplicate of #147 (comment)

@vBenTec vBenTec closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant