Skip to content

Commit

Permalink
fix: useCollection type wasn't parsing correctly (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Nov 10, 2023
1 parent 512abeb commit 7d1a678
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/radix-vue/src/shared/useCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import {
const ITEM_DATA_ATTR = 'data-radix-vue-collection-item'

type ContextValue = Ref<HTMLElement[]>

/**
* Composables for provide/inject collections
* @param key (optional) Name to replace the default `Symbol()` as provide's key
*/
* @param name (optional) Name to replace the default `ITEM_DATA_ATTR` for the item's attirbutes
*/
export function useCollection(key?: string, name = ITEM_DATA_ATTR) {
const COLLECTION_SYMBOL = key ?? (Symbol() as InjectionKey<ContextValue>)

const createCollection = (sourceRef?: Ref<HTMLElement | undefined>) => {
const items = ref<HTMLElement[]>([])
const items = ref([]) as Ref<HTMLElement[]> // ref<HTMLElement[]> is causing type inference issue

function setCollection() {
const sourceEl = unrefElement(sourceRef)
Expand Down

0 comments on commit 7d1a678

Please sign in to comment.